addJSONData jqgrid
I want to use addJSONData
function fo开发者_运维知识库r adding a new row to my jqGrid.
$("#grid_id")[0].addJSONData(newRowJSONData);
It works, but when I try
$("#grid_id")[1].addJSONData(newRowJSONData)
this gives an undefined error please help me how can I add more than one new row to jqGrid?
The expression $("#grid_id")[1]
means the second element on the page, which has the id equal to grid_id
. Because the ids must be unique on the page the expression $("#grid_id")[1]
produce undefined
result. So $("#grid_id")[1].addJSONData(newRowJSONData)
should gives an error.
I don't understand you statement: "I want to use addJSONData
function for adding a new row to my jqGrid.". I could understand that you what to fill the grid with data which you have as an object, but I see no sense in the requirement to use an special method. If you need some help you should describe your real problem without the choosing of one special method. Then other people could try to help you.
精彩评论