Extjs Ext存储未正确加载数据
我真的被这件事缠住了,如果有任何提示,我将不胜感激。当我尝试加载我的“dealerList”存储时:Extjs Ext存储未正确加载数据,extjs,Extjs,我真的被这件事缠住了,如果有任何提示,我将不胜感激。当我尝试加载我的“dealerList”存储时: updateDealerList : function (){ myapp.stores.dealerList.load(); } 编辑:没关系,最后我自己解决了。。。当我停止使用关联时,存储工作原因是您的配置不正确 您的DealerList模型映射到currentPage、totalPages和dealers,但读者有一个dealers的根。设置JSON的方式应如下所示: {
updateDealerList : function (){
myapp.stores.dealerList.load();
}
编辑:没关系,最后我自己解决了。。。当我停止使用关联时,存储工作原因是您的配置不正确 您的DealerList模型映射到currentPage、totalPages和dealers,但读者有一个dealers的根。设置JSON的方式应如下所示:
{
dealers : [
{
currentPage : 0,
totalPages : 10,
dealers : [....]
}
]
}
但这不是你想要的。使用PHP文件中的JSON,您的Model+存储应该是这样的:
Ext.regModel('DealerList', {
fields : [
'dealerName'
]
});
myapp.stores.dealerList = new Ext.data.Store({
model : 'DealerList',
proxy : {
type: 'ajax',
url : 'dealerresults.php',
extraParams: {
app_id: '<?php echo $app_id; ?>',
arrayParam: ['value1', 'value2']
},
reader: {
type: 'json',
root: 'dealers',
}
}
});
Ext.regModel('dealList'{
字段:[
“dealerName”
]
});
myapp.stores.dealList=新建Ext.data.Store({
模型:“DealerList”,
代理:{
键入:“ajax”,
url:'dealerresults.php',
外部参数:{
应用程序id:“”,
arrayParam:['value1','value2']
},
读者:{
键入:“json”,
根:'经销商',
}
}
});
读取器将获取整个JSON字符串并对其进行解析。基于读取器中指定的根,它在那里查找您想要的记录,因此JSON中的“经销商”就是您的记录所在的位置