extjs中store的问题

shenqian5337 2010-02-28 01:18:01
初学extjs,
后台ProcessQuery.ashx:
string xmlString = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<NewDataSet>\n" +
"<Table>\n" +
"<a>1</a>\n" +
"<b>2</b>\n" +
"<c>3</c>\n" +
"<d>4</d>\n" +
"<e>5</e>\n" +
"<f>6</f>\n" +
"<g>7</g>\n" +
"<h>8</h>\n" +
"</Table>\n" +
"</NewDataSet>";
context.Response.ContentType = "Application/xml";
context.Response.Write(xmlString);

前台:
Ext.onReady(function() {

var dsCust = new Ext.data.Store({

proxy: new Ext.data.HttpProxy({ url: 'PeocessQuery.ashx'}),
reader: new Ext.data.XmlReader({
record: "Table",
},
['a', 'b', 'c', d', 'e', 'f', 'g', 'h'])
});
dsCust.load();
dsCust.on('load', function() { alert(123); })
alert(dsCust.getCount());
})
测试时alert不弹出123, 只弹出0,请问哪块出了问题。
...全文
164 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
shenqian5337 2010-02-28
  • 打赏
  • 举报
回复
应该是编码问题,我后台生成的xml字符串的字节<a><b>那些 有的是中文,我以为是语法问题,所以为了方便帖子举的例子直接就都是英文了,呵呵 ,请问字符编码问题 是后台处理还是前台处理呢,我后台试了很多种输出编码为utf-8的 还是没有效果,前台有设置方法吗
asdujiayong 2010-02-28
  • 打赏
  • 举报
回复
可能也是你发贴时敲错了,
['a', 'b', 'c', d', 'e', 'f', 'g', 'h']) 
asdujiayong 2010-02-28
  • 打赏
  • 举报
回复
没了,这样可以了呀,我试过了。。。
shenqian5337 2010-02-28
  • 打赏
  • 举报
回复
引用 2 楼 asdujiayong 的回复:
JScript codevar dsCust=new Ext.data.Store({

proxy:new Ext.data.HttpProxy({ url:'ProcessQuery.ashx'}),//这里 reader:new Ext.data.XmlReader({
record:"Table"//, },
['a','b','c','d','e','f','g','h'])
});
dsCust.load();
dsCust.on('load',function() { alert(123); })
alert(dsCust.getCount());



record:'table' 那块 我是发帖时多写了一个逗号,实际里是没有的 ,请问除了那还有哪块有问题
asdujiayong 2010-02-28
  • 打赏
  • 举报
回复
var dsCust = new Ext.data.Store({

proxy: new Ext.data.HttpProxy({ url: 'ProcessQuery.ashx'}), //这里
reader: new Ext.data.XmlReader({
record: "Table" //,
},
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])
});
dsCust.load();
dsCust.on('load', function() { alert(123); })
alert(dsCust.getCount());
asdujiayong 2010-02-28
  • 打赏
  • 举报
回复
Ext.onReady(function(){
var dsCust = new Ext.data.Store({

proxy: new Ext.data.HttpProxy({ url: 'PeocessQuery.ashx'}),
reader: new Ext.data.XmlReader({
record: "Table"
},
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])
});
dsCust.load();
dsCust.on('load', function() { alert(123); })
alert(dsCust.getCount());
})

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧