Hi,
I have a problem with my store and the load() function.
I tried this:
Store:
Code:
config : {
model : 'MyApp.model.MyAppModel',
proxy : {
type : 'ajax',
url :'../app/statistics.json',
extraParams: {
type: 'NECESSARY_TYPE'
},
reader : {
type : 'json',
rootProperty : 'statistics'
}
}
}
Code:
var myStore= Ext.data.StoreManager.get('MyStore');
var storeParams = {
entity: record.get('entityId')
};
if (record.get('anotherId')) {
storeParams.anotherId= record.get('anotherId');
}
myStore.load(storeParams);
But it did not work. The entityId was always 1, so it didn't change and I don't know why.
Then I tried this:
Code:
myStore.getProxy().setExtraParams({entity: record.get('entityId')});
But it overrides(deletes) the param 'type' in the store/proxy configuration which was also horrible.
Then I did this:
Code:
var myStore= Ext.data.StoreManager.get('MyStore');
myStore.getProxy().setExtraParams({
entity: record.get('entityId'),
anotherId: record.get('anotherId'),
type : 'NECESSARY_TYPE'
});
myStore.load();
And it's working. But I don't want to have too much information in my controller.
What am I doing wrong here?