extjs获取不到json数据,大侠们帮忙看看
时间:2011-11-14
来源:互联网
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: './json/aaaa.action'
}),
reader: new Ext.data.JsonReader(
{
totalProperty: 'total',
root: 'rows'},
[
{name: 'title'} ,
{name: 'context'},
{name: 'index_id', type:"int" } ]),
remoteSort:true
});
store.load();
alert(store.getCount());
控制台输出的数据是
{"total":2,"rows":[{"title":"学校概况","context":"帮忙你本命年科技","index_id":1},{"title":"校训详解","context":"个个 即可很快 看 ","index_id":2}]}
但store就是获取不到数据,不知道错在哪里了??
proxy: new Ext.data.HttpProxy({
url: './json/aaaa.action'
}),
reader: new Ext.data.JsonReader(
{
totalProperty: 'total',
root: 'rows'},
[
{name: 'title'} ,
{name: 'context'},
{name: 'index_id', type:"int" } ]),
remoteSort:true
});
store.load();
alert(store.getCount());
控制台输出的数据是
{"total":2,"rows":[{"title":"学校概况","context":"帮忙你本命年科技","index_id":1},{"title":"校训详解","context":"个个 即可很快 看 ","index_id":2}]}
但store就是获取不到数据,不知道错在哪里了??
作者: thr_Csdn 发布时间: 2011-11-14
在 load事件中输出看看
...
,listeners:{
load:function(){
alert(store.getCount());
}
}
...
,listeners:{
load:function(){
alert(store.getCount());
}
}
作者: hookee 发布时间: 2011-11-14
引用 1 楼 hookee 的回复:
在 load事件中输出看看
...
,listeners:{
load:function(){
alert(store.getCount());
}
}
在 load事件中输出看看
...
,listeners:{
load:function(){
alert(store.getCount());
}
}
返回的是0
作者: thr_Csdn 发布时间: 2011-11-14
测下来没错, 只是中文的话,aaaa.action 返回页面的编码用UTF-8
JScript code
JScript code
Ext.onReady(function(){ var store = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'test.asp?' + escape(new Date()) }), reader: new Ext.data.JsonReader( { totalProperty: 'total', root: 'rows'}, [ {name: 'title'} , {name: 'context'}, {name: 'index_id', type:"int" } ] ), listeners:{ load:function(){ alert(store.getCount()); } } }); store.load(); });
作者: hookee 发布时间: 2011-11-14
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28