This is my grid:
colModel: [
{ name: "userGroupID", index: "userGroupID", width: 50, hidden:true, align: "left" },
//{ name: "userId", index: "userId", width: 75, align: "left",title:false,search:false, sorttype:'text'},
{ name: "userInfoID", index: "userInfoID", width: 75, align: "left",hidden:true,title:false,search:true, sorttype:'text'},
{ name: "userID", index: "userID", width: 75, align: "left",title:false,search:true, sorttype:'text'},
{ name: "firstName", index: "firstName", width: 75, align: "left",title:false,search:false, sorttype:'text'},
{ name: "organizationName", index: "organizationName", width: 75, align: "left",title:false,search:false, sorttype:'text'},
{ name: 'action', index: 'action', width: 70, align: "left",sortable: false, search:false}
],
I am getting data from server to populate grid and trying to add my own data to the grid.
I used
var grid = jQuery("#jqTable");
var data = [{"userGroupID":"2","userInfoID":"2","userID":"userID","firstName":"firstName","organizationName":"organizationName"}];
//jQuery("#jqTableList").addRowData("userGroupID",data);
grid.jqGrid('addRowData','1',data);
//jQuery("#jqTableList").trigger("reloadGrid");
It is saying: TypeError: t.p is undefined
u = t.p.rownumbers === true ? 1 : 0;
Please help me..
You use
addRowDatamethod in the wrong way. If you want to use it to add multiple rows you should change the first parameter ofaddRowDatamethod.You can read the following in the documentation of jqGrid:
So if for example
userGroupIDcontains the unique values which could be interpreted as id of every row you can useaddRowDatain the following formIn your current your code which you posted the column with the name
'1'will be interpreted asid. By the way it’s very important to specify theidvalues for the grid. If the columnuserGroupID(or some other column of the grid) really could be used as id you should addkey: trueproperty in the column. The property can used only for one column.In general I don’t recommend to use
addRowDatafor filling the grid if the data are known at the time of creating of the grid (see the answer for details). If you have grid withdatetype: "local"it’s much more effective to usedata: yourArrayWithData. If you need to replacedataof the grid you can useSee the answer