jqGrid is powered by remote json data in ASP .NET MVC2 application.
On page load two requests are sent to server: one to retrieve whole html page with colmodel and second invoked by jqgrid to retrieve data.
colmodel is stored in database and depends on user rights and user configuration. Creating colmodel requires number of sql server calls which take a while.
Both request require building colmodel in server. For data retrieval colmodel is required to get correct number of columns to build select statement.
Currently this colmodel is built two times for every request. Also total number of recods is required to be returned which is slow on large data (causes whole result scan in PostgreSql server).
How to speed the things up ?
How to build colmodel only once and send it and data in same request?
I agree that extension of jqGrid to support the loading of some parts of
colModelper one Ajax will be very helpful. For about a year I posted the feature request for example.What you can do now:
userDatapart of JSON response for example. To have better performance with many hidden columns I would recommend you to callshowColorhideColinside ofbeforeProcessingand hide/show the columns on the empty grid. It will speed up the performance ofshowColorhideColdramatically. If it’s needed you can include additional call ofclearGridData.colModel. I don’t understand why it should be slow. All depends from your implementation. In any way I am sure that one can make the retrieval really quickly.recordsfield of the JSON response and settotaltopage+ 1. It enebles the “Next” button of the pager. You should settotalequal topageonly if you returns less rows as therows(number of rows per page). In the most cases it will be good criteria to detect the last page. You can additionally hide some field on the pager lake the “Last” button and thesp_1_...span which shows the total number of pages. You can do this by the usage ofpgtext : "Page {0}"option or the usage ofpginput: falseto have no pager input at all. Theviewrecordsshould befalse(its default value). After all the customization you will don’t need to calculate the total number of records and in the way improve performance of the database request in case of large data.