PDA

View Full Version : Store Creation code



AJAIN32
17 Sep 2014, 6:37 AM
Hi,

I have created a store which is having a proxy to get the data.

Structure of store i have -

constructor:function(cfg)
var me = this;
cfg = cfg ||{};
me.callParent([Ext.apply({
// some configuration of store
cfg});

So my question is- it is working without this constructor also as expected,i know that some of the functionality may behave differently by not calling the parent class constructor.

But do we really need to do such code or after defining or can call the constructor of parent class in a single line ?

or do we really need to call these code is there any impact by not defining that as i can see the same functionality without that.

Please suggest how to simplify the things.

Thanks,
Ankit

AlessandroTorrisi
17 Sep 2014, 1:22 PM
Maybe I missunderstand you, but why you need to use the contructor?



Ext.define('MyStore', {
extend: 'Ext.data.Store',
model : 'MyModel',
proxy:{
type:'ajax',
url:'/users.json',
reader:{
type:'json',
root:'users'
}
},
autoLoad:true
});

should work fine

AJAIN32
17 Sep 2014, 8:57 PM
Thanks for the reply !!

But the same thing i am asking. is there any impact not using the constructor ?

Thanks,
Ankit