简体   繁体   中英

Sorting JqGrid on Load

I'm sorting my data on load in the jqgrid using the sortname and sortorder attributes. My problem is that it doesn't go through the onSortCol event that I've set up. onSortCol is only called when the grid is sorted by clicking on the column. Is there an event that is called before the sort happens on load?

Try using this method with reload = true, it works for me fine:

jqGrid('sortGrid', colName, reload)

from Wiki :

Sorts the given colname and shows the appropriate sort icon. The same (without sorting icon) can be done using setGridParam({sortname:'myname'}).trigger('reloadGrid'). If the reload is set to true, the grid reloads with the current page and sortorder settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM