ExtJS:在本地变量中获取代理帖子的响应 [英] ExtJS: Getting response of Proxy post in local variable
本文介绍了ExtJS:在本地变量中获取代理帖子的响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个代理类型为AJAX的商店:
tableStore = Ext.create('Ext.data.Store',{
model:'TableData',
pageSize:20,
proxy:{
类型:'ajax',
url:url
}
});
调用 url
返回一个JSON对象。我想在一些局部变量中获取这个JSON对象来做一些处理。
这是可能吗?
谢谢。
解决方案
您可以参考转换中获得的数据:
Ext.define ('MyModel',{
extends:'Ext.data.Model',
fields:[
{name:'id',type:'int'}
,{ name:'title',type:'string'}
]
,proxy:{
type:'rest'
,reader:{
type:'json '
,transform:{
fn:function(data){
//你在这里编码
return data;
}
,scope:this
}
}
}});
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.
解决方案
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
}
}
}});
这篇关于ExtJS:在本地变量中获取代理帖子的响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文