PDA

View Full Version : Store load event params undefined



martinrame
3 Jun 2012, 1:06 PM
I'm trying to load only one element in a model instance, so I'm creating a store with an Ajax Proxy, then filtering it and executing it's load method.

I would like to catch the result of load event, and do something useful with the returned records, but I'm getting all three params of load function "undefined".

The proxy method is called after I call "lStore.load()" and the "load" event is called, but all params ar "undefined".



var lStore = Ext.create('MyApp.store.Clientes');
lStore.load = function(store, records, success){
// store, records and success are undefined.
};
lStore.filter('nrotarjeta', this.getTarjeta());
lStore.load();
lStore.clearFilter(true);

vietits
3 Jun 2012, 3:34 PM
Instead of listening to 'load' event, you override the load() method of the store. You should fix your code as below:


var lStore = Ext.create('MyApp.store.Clientes');
//lStore.load = function(store, records, success){
// store, records and success are undefined.
//};
lStore.on('load', function(store, records, success){
// your code here
});
lStore.filter('nrotarjeta', this.getTarjeta());
lStore.load();
lStore.clearFilter(true);