我有一个JsonStore配置,像这样:如何让ExtJS JsonStore将JSON数据直接放入请求正文中?
var store = new Ext.data.JsonStore({
restful: true,
url: '/categories',
remoteSort: true,
idProperty: 'Id',
totalProperty: 'total',
root: 'results',
writer: new Ext.data.JsonWriter({
encode: false
}),
fields: [ 'Id', 'Name' ]
});
我抓住一些数据从服务器,然后编辑的记录之一。当我告诉店里保存,发送此JSON回服务器:
{
"results":
{
"Name":"Trivial123",
"Id":2
}
}
该店包裹JSON的results
属性(在商店设置root属性)内。但是,服务器预计这样的:
{
"Name":"Trivial123",
"Id":2
}
换句话说,序列化的实体,应直接在响应体内放,而不是裹着的属性。有谁知道我如何配置商店来做到这一点?
我从服务器获取的JSON实际数据放在'results'属性中。你只是给了我一个想法,但我会尝试。 – 2010-05-28 19:46:32
这是什么想法? – Gary 2011-04-13 15:16:53