I have a grid where the colmodel looks like:;
colModel:[
{name:'id',index:'id', width:30, sorttype:'int'},
{name:'name',index:'name', editable:true, width:200},
{name:'group.id',index:'group.id', editable:true, width:200, formatter:'select', edittype: 'select'},
{name:'sql',index:'sql', editable:true, width:100}
],
When I now edit the data and post it to the server the json looks like:
{"name":"Name 1","group.id":"1","sql":"sql","oper":"edit","id":"1"}
But my server expects a multi-level json like:
{"name":"Name 1","group":{"id":1},"sql":"sql","oper":"edit","id":"1"}
My serializeEditData looks like:
serializeEditData:function(data) {
if (data.id === '_empty')
data.id = null;
return JSON.stringify(data)
}
Is there an elegant way to format javascript objects as multi-level json?