I have a grid in my application. To fill it with data, the user fills out a form and submits it. The server responds with JSON data containing all the results for the grid (the server is not hit again).
In terms of jqGrid, the settings would be loadonce: true
and datatype: "json"
. But these don't work together.
What I have been doing -- and it seems like a poor way of doing it -- is the following, which changes the grid settings, loads data, and changes the grid's settings back.
$("#myGrid").jqGrid("setGridParam", {datatype: "json", loadonce: true});
$("#myGrid")[0].addJSONData(data);
$("#myGrid").jqGrid("setGridParam", {datatype: "local", loadonce: true});
Is there another, better way?
Thanks!