I created custom json reader as suggest by James Clark in following post.
Here is a code for creating custom json
Ext.define('MyReader', {
extend: 'Ext.data.reader.Json',
alias: 'my-json',
read: function (object) {
debugger;
object.Results = Ext.decode(object.responseText);
this.callParent([object]);
}
});
In store definition I assing custom reader
var store = Ext.create('Ext.data.Store', {
//model: 'Option',
fields: fields,
pageSize: itemsPerPage,
proxy: {
type: 'ajax',
url: getDataWithPageURL,
**reader:Ext.create('MyReader', {root: 'Results', totalProperty: 'Total'})**
}
});
The json that I receiving from clients look like this
{"Results":["{\"BaseCurrency\":\"USD\",\"TermCurrency\":\"JPY\"}","{\"BaseCurrency\":\"USD\",\"TermCurrency\":\"JPY\"}","{\"BaseCurrency\":\"USD\",\"TermCurrency\":\"JPY\"}","{\"BaseCurrency\":\"USD\",\"TermCurrency\":\"JPY\"}"],"Total":4}
I receiving an error in ext-js.js I debuged it and the error occurs in Ext.data.proxy.Server class in following code
if (success === true) {
reader = me.getReader();
result = reader.read(me.extractResponseData(response));
records = result.records;
result is undefined.
Please help