extjs jsonReader

lopyn 2012-05-21 11:48:43
小弟我今天想了解一下 ext 的datastore 和 JsonReader
碰到一个问题 不知道如何取到数据?
首先我创建了一个aspx 页面

<script type = "text/javascript">
Ext.onReady
(
function()
{



var store = new Ext.data.Store
(
{
proxy : new Ext.data.ScriptTagProxy({url:'sent.ashx'}),
reader: new Ext.data.JsonReader({

successProperty: "successProperty",

totalProperty: "totalProperty",

root: "root",

id: "id"

},

[
{name: 'id'},
{name: 'name'}
]
)
}
);
//store.load({params:{start:0, limit:10}});

store.load({callback:function(records, options, success)
{
alert('info');
alert(success);

}
});


}
);


sent.ashx 中的内容

context.Response.ContentType = "text/plain";
string data = "{id:0,totalProperty:2,successProperty:true,root:[{id:'id1',name:'name1'},{id:'id2',name:'name2'} ]}";

context.Response.Write(data);


...全文
127 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,502

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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