I am working on some code using store.load. This is my example.
store.load({
callback: function(records, operation, success) {
if(success){
var id = store.getAt(0).data.id;
}
});
Is there a way to access records.length outside the store.load? For example, something like this?
store.load({
callback: function(records, operation, success) {
var id = store.getAt(0).data.id;
console.log(id); //returns the right value, but cannot use this value outside the load.
}
});
console.log(id);//returns undefined.
Yes you can do that.
//Get the store
var store = Ext.getStore("STORE_NAME")
//now get the data response set in the store
var myDataResponse = store.proxy.reader.rawData
//myDataResponse is the full set of records in the store
Hope it helps!