PDA

View Full Version : how to get record from store without using load function in extjs4.1



vijayakumar84
17 Jul 2013, 8:36 AM
Hi,
I have the json response with totalCount Values.I am getting the totalCount value in load function.I am creating store in controller.before loading store If(totalCount>0). It is executing else condition.Can nybody tell how to loaded store and check the conditon?.Is it possible to get record from field without load function?


var totalCount=0;
store.load({ scope: this, callback: function(records, operation, success) { totalCount=records[0].data.totalCount }});if(totalCount>0)
{
console.log("record found");
}

else {
console.log("record not found");
}



Thanks

slemmon
18 Jul 2013, 9:36 PM
You might set a listener on the store on the load event.
The load handler is passed a couple of params: the first is the store and the second is an array of records from the load action.



listeners: {
load: function (store, records) {
console.log(records.length);
}
}