PDA

View Full Version : Creating an custom EventDomain



duncan_mcmillan
25 Jul 2013, 1:29 AM
Hi<br><br>I am trying to create a custom EventDomain, mainly so I can experiment with using it in my Unit testing. When I try and create this custom EventDomain class I get this error:<br><br>uncaught TypeError: object is not a function<br><br>My CustomEventDomain class is as follows:<br><br>Ext.define('UTM.cusomtEventDomains.TestController', {<br>&nbsp; &nbsp;extend: 'Ext.app.EventDomain',<br>&nbsp; &nbsp;singleton: true,<br>&nbsp; &nbsp;requires: [<br>&nbsp; &nbsp; &nbsp; &nbsp;'Ext.data.Model<br>&nbsp; &nbsp;],<br>&nbsp; &nbsp;type: 'testctrl',<br>&nbsp; &nbsp;idProperty: 'id',<br>&nbsp; &nbsp;constructor: function () {<br>&nbsp; &nbsp; &nbsp; &nbsp;var me = this,<br>&nbsp; &nbsp; &nbsp; &nbsp;me.callParent(),<br>&nbsp; &nbsp; &nbsp; &nbsp;me.monitor(Ext.data.Model);<br>&nbsp; &nbsp;}<br>});<br><br>No matter what monitor class I use it still fails, I know the monitor Class must use the Observable interface<br><br>I create using<br>var ced = Ext.create('UTM.cusotmEventDomains.TestController', {<br><br>});<br><br>If I try and create using 'new' it still fails.<br><br>Any Ideas where I am going wrong?<br><br>Thanks<br><br>Duncan<br><br>

duncan_mcmillan
25 Jul 2013, 1:37 AM
Resent due to formatting issues:

Hi
I am trying to create a custom EventDomain, mainly so I can experiment with using it in my Unit testing. When I try and create this custom EventDomain class I get this error:

uncaught TypeError: object is not a function

My CustomEventDomain class is as follows:


Ext.define('UTM.cusomtEventDomains.TestController', {
extend: 'Ext.app.EventDomain',
singleton: true,
requires: [
'Ext.data.Model
],
type: 'testctrl',
idProperty: 'id',
constructor: function () {
var me = this
me.callParent(),
me.monitor(Ext.data.Model);
}
});

No matter what monitor class I use it still fails, I know the monitor Class must use the Observable interface
I create using

var ced = Ext.create('UTM.cusotmEventDomains.TestController', {});

If I try and create using 'new' it still fails.

Any Ideas where I am going wrong?

Thanks

Duncan

existdissolve
25 Jul 2013, 5:24 PM
Here's an experiment I did: http://existdissolve.com/2013/05/extjs-quickie-custom-event-domain/

duncan_mcmillan
26 Jul 2013, 9:03 AM
Hi existdissolve

Thanks for the reply, but your post which I have read before has no details how you instantiate the custom EventDomain, is this because you do not need to? Or does the Ext.Loader load it via an Application requires[] declaration?

A full code post would be appreciated.

Thanks again

Duncan

existdissolve
26 Jul 2013, 6:08 PM
All I did in my example was to include it as part of the requires config in my application. Here's the full example from the app in which I did it:

https://github.com/existdissolve/CarTracker/blob/master/PartEleven/cartracker/app.js