开发者

Customising the JSON generated by EXT-JS

I am using EXT-JS 3.2.0 and I have an Ext.grid.EditorGridPanel backed by a Ext.data.Store object. The store has the restful flag on and uses Ext.data.JsonReader and Ext.data.JsonWriter. It works great for retrieving data and populating the grid. However, when I add or update a record, the JSON produced for the POST/PUT has the data nested under a root field. This is n开发者_开发百科ot matching up with what the service I am calling expects. It wants a flat object. For example, when I add or update a record, the JSON produces looks something like this:

{
   "data":  {
      "name": "TEST",
      "id": "-1"
   }
}

But I need it to be

{
   "name": "TEST",
   "id": "-1"
}

Any ideas?

Thanks,

John


I don't know if it's the best approach but I ended up creating my own Ext.data.Connection object and making the request where I needed it, for example on the delete. Not the solution I was hoping for but it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜