PDA

View Full Version : Not able to get the records returned by service using load event of the store



webfriend13
21 Mar 2012, 3:37 AM
Hi all,

My service returns JSON object which has three array in it. When I use following code I can access these objects.



Ext.Ajax.request({
url: urlData,
params: {
total: 5000
},

success: function (responseData) {
wholeResult = Ext.decode(responseData.responseText);
resultFields = wholeResult.fields; //Fields is array one in json result
resultColumns = wholeResult.columns; //Fields is array two in json result
resultData = wholeResult.data; //Fields is array three in json result



But for the same when I use store load event, I am not able to see the result. My store is using a model in which i have not defined any fields as I am unaware about the no of columns that will be returned from my service. I am not sure if this is the reason.



onResultStoreLoad: function (mystore, records, successful, operation, options) {
//i am not able to see the three arrays using records or mystore.
}



Please provide your suggestions.

mitchellsimoens
21 Mar 2012, 9:21 AM
Yes, your model needs to have fields in order to map the data.

webfriend13
21 Mar 2012, 9:23 PM
You can get the result using following code:



onResultStoreLoad: function (mystore, records, successful, operation, options) {
var v = mystore.proxy.reader.jsonData;
}