I have a column model like that:
...
{name:'password',index:'password', width:100},
{name:'type.name',index:'type.name', width:100},
...
My class like definitons:
var MyObject = function (password, type) {
this.password = password;
this.type = type;
};
var MyType = function (tname) {
this.tname = tname;
};
I populate my variables: like that:
var type = new MyType($('#typeList').val());
var myObject = new MyObject($('#password').val(), type);
I have a JSON data response from my server and some of it’s elements are object as like type. When I want to show them at my grid its OK. However when I want to use addrowdata function I can not see anything at type column. I am doing like that:
$("#gridId").jqGrid('addRowData', myObject.password, myObject, "first");
class is the function that hold name, password etc. inside it. The problem is only with nested elements(I can see password etc. at my grid). addrowData fonction accepts an array but I send a abject that holds object. How can I convert my object of objects into a plaint object array?
Any ideas?
You should not use points in the
nameproperty! If needed you can use if inindexor injsonmap.The usage of addRowData in your example seems me wrong. You should reread the documentation of addRowData method.