The thing is, the functions populate and updatePager often happen in tandem, so you see that when sorting and paging, both callbacks are called. Looking at the source of jqGrid (source) you can see that gridComplete is called on just one line of grid.base.ġ725: if($.isFunction(ts.p.gridComplete)) If you load the data from the server and if you don't use loadonce: true option, clearGridData, addRowData and delRowData then you could use gridComplete instead of loadComplete. On the other side loadComplete will be called later after all data returned from the server are processed and saved locally in data and _index. At this moment data and _index contains only the data for the page. One can see when using loadonce: true the callback gridComplete will be called after the first page of data are loaded from the sever. ![]() If one uses loadonce: true and the internal parameters data and _index will be filled with full data returned from the server. It's not what one mostly want.Īnother disadvantage of gridComplete one can see if one examines the code of addXmlData (see here) and addJSONData (see here) from where updatepager is called and so gridComplete will be called. On the other side gridComplete will be called (in the current version of jqGrid 4.4.4) from internal updatepager (see here), which will be called from delRowData (see here), addRowData (see here) and clearGridData (see here) methods in addition to addXmlData (see here) and addJSONData (see here). loadComplete has parameter data which represent full page of local data or full data loaded from the server.It's important to understand, that if the user changes sorting of some column or sets filter or chooses another page of the grid the grid body will be reloaded. ![]() For example after loading the page on the grid from the server. It's the last callback which will be called if the whole grid body will be reloaded.I prefer to use loadComplete because of some advantages of loadComplete and disadvantages of gridComplete. If you examine code from all my examples which I posted, you will find gridComplete only when the Original Poster posted it in the question and I would have modified a little code. I think that this question is asked by many users of jqGrid.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |