PDA

View Full Version : Store callback function on load + Operation



TDeBailleul
16 Jan 2012, 8:25 AM
Hi everyone,

I can't find a way to specify an Ext.data.Operation and a callback function in the load method of a store.

I presently have this :



app.stores.actualites.load({
new Ext.data.Operation(
start:0,
limit:app.stores.actualites.getCount(),
})
);


How should I add the callback function ?

Thank you

mitchellsimoens
16 Jan 2012, 8:31 AM
You don't pass an instance of Operation, you pass a config...


store.load({
params : {},
success : function() {},
failure : function() {},
callback : function() {}
});

TDeBailleul
16 Jan 2012, 9:08 AM
Thanks for your answer.
Here's what I'm doing now :



refreshActu: function(user, newsPerLoad) {
app.loadmask.show();
app.stores.actualites.load({
params : {
start:0,
limit:newsPerLoad
},
callback : function(records, operation, success) {
app.loadmask.hide();
console.log(newsPerLoad+" / "+app.stores.actualites.getCount()); <--- 1 / 21
}
});
},


The callback function works but params don't..
Is there anything I'm doing wrong here ?

mitchellsimoens
16 Jan 2012, 9:18 AM
This sent the params:


var store = new Ext.data.Store({
fields : ['company'],
proxy : {
type : 'ajax',
url : 'data.php',
reader : {
type : 'json',
root : 'data'
}
}
});

store.load({
params : {
foo : 'bar'
},
callback : function() {
console.log('returned');
}
});

grajkamal9
14 Oct 2014, 6:40 AM
How to fetch the value of the field company in the above Code from variable store


thank you,
Beginner

grajkamal9
14 Oct 2014, 10:35 PM
any one answer please its urgent . How to fetch the value of the field company in the above Code from variable store