I have a Jqgrid which has datatype as local. I am loading data at run time using addRowData, setCell. Every thing is working great. Note that I am not loading the entire data into grid so grid does not know how many pages are there. My server returns the count which I need to set it to the grid. The docs say that lastpage is ReadOnly? How do I set my last page(number of pages) to the grid? Any suggestions.
Thanks,
Sarath
I have a Jqgrid which has datatype as local. I am loading data at
Share
The usage of
addRowDatamethod to fill jqGrid is the most old and the most ineffective way to fill the data in jqGrid. The problem is easy. If you place an element on the page the position of all other elements on the page have to be recalculated. It makes many resources of the web browser. The filling of the whole jqGrid body in one step is much more effectively especially with the large number of inserted rows. It’s really needed to useaddRowDatamethod only in seldom cases.Much more effective will be to use
dataparameter of jqGrid which allows to fill the grid with the data, sort the data corresponds tosortnameandsortorderand display the first page whererowNumdefines the number of rows per page. Additionally one should not useafterInsertRowcallback and usegridview: true. In the case the filling of jqGrid is the most effective.The number of pages of the grid will be calculated automatically based on the number of rows in the grid. Only if you use server side
datatype('json'or'xml') the client part don’t know the total number of pages and so one have to fill in the input datatotal,pageandrecordstogether with the main data (see documentation). If one uses low level methodaddJSONDataone can fill grid with the data and still settotal,pageandrecordsto any values which you want.Another way which you can use in some scenarios is
datatype: 'jsonstring'. The data can be placed as the value ofdatastroption. By the way the value ofdatastrmust be not only the JSON string but can be an object too.