I am using Jqgrid to show some data, using DataType as local, I don’t want to post back to the server and return jsonString with the data to bind. I am passing the Json String to the client and adding the data one by one using addRowData. It seems it is taking a noticeable time to the user if the number of the data is big due to the information I have in each cell.
for (var i = 0; i < gridData.length; i++)
jQuery("#jqgInventory").jqGrid('addRowData', i + 1, JSON.parse(gridData[i]));
Is there any alternative way to bind the data to jqgrid, for example just give it the JsonString as a datasource and it will bind it faster or any other suggestion.
Note: Using DataType as Json and setting the postUrl will work faster than the above method.
please any help !
Thanks in advance,
Alaa
This sentence comes directly from the jqGrid documentation: “A array that store the local data passed to the grid. You can directly point to this variable in case you want to load a array data. It can replace addRowData method which is slow on relative big data”. That is exactly what you are talking about.
See it here: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options
Here is your working example: http://jsfiddle.net/yNw3C/649/
You simply have to put in the option:
Where
my_datais the array of information.