PDA

View Full Version : Namespace and Ext.define problem



whalethewise
30 Jan 2012, 2:56 PM
Hi

Are there any changes for using Ext.namespace and Ext.define in 4.1? Could Ext.data.Store be extended?

As it worked for me in 4.0.7, now I have issues with 4.1 finding the class in predefined namespace.
What could be wrong in my following code in 4.1 prospective?


Ext.namespace('com.myclass.store');
Ext.namespace('com.myclass.model');

Ext.define('com.myclass.store.KeyValueListStore', {
extend: 'Ext.data.Store',
constructor: function(config) {
config = config || {};
config.fields = ['key','value', 'selected'];
if (config.autoLoad == undefined)
{
config.autoLoad = true;
}
config.clearOnLoad = true;
config.proxy = {
type: 'ajax',
reader: {
type: 'json',
root: 'kvlist'
},
listeners: {
exception: function(proxy, exception, operation) {
alert('1');
}


}
};
config.sorters = [
{
property: 'value',
direction: 'ASC',
transform: ignoreCaseSort
}
];
config.proxy.url = myurl + 'kvlist/' + config.proxyUrl;
this.callParent([config]);
},
setProxyUrl: function(urlName) {
this.proxy.url = contentlibraryUrl + 'kvlist/' + urlName;
}
});

var mystore = Ext.create('com.myclass.store.KeyValueListStore', {
proxyUrl: 'test'
});

mitchellsimoens
31 Jan 2012, 6:40 AM
You shouldn't need to use Ext.ns/Ext.namespace. Ext.define should do that automatically.

whalethewise
31 Jan 2012, 10:11 AM
is it new for 4.1?

mitchellsimoens
31 Jan 2012, 10:31 AM
is it new for 4.1?

No, to 4.x yes. I have been using Ext.define without using Ext.ns for a year now