问题
I am new to ExtJS so please excuse if this is very basic. I googled but couldn't find any useful answer.
I have a Store with proxy type AJAX:
tableStore = Ext.create('Ext.data.Store', {
model: 'TableData',
pageSize: 20,
proxy: {
type: 'ajax',
url: url
}
});
The call to url returns a JSON object. I want to get this JSON object in some local variable to do some processing.
Is this possible?
Thanks.
回答1:
You can refer to the data obtained in the method transform:
Ext.define('MyModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'int'}
, {name: 'title', type: 'string'}
]
, proxy: {
type: 'rest'
, reader: {
type: 'json'
, transform: {
fn: function (data) {
//you code here
return data;
}
, scope: this
}
}
}});
回答2:
try with this
tableStore.getProxy().getReader().rawData
来源:https://stackoverflow.com/questions/27403915/extjs-getting-response-of-proxy-post-in-local-variable