changing the default sort on jqgrid
There is probably a quick solution here but i couldn't find it....
I want开发者_如何转开发 to change the default sorting when clicking on the column header from 'asc' to 'desc',
I tried adding this code, it changes the direction of the sorting but still the icon of the arrow is opposite:
onSortCol: function (index, columnIndex, sortOrder) {
sortOrder = (sortOrder == 'asc' ? sortOrder = 'desc' : sortOrder = 'asc');
jQuery("#grid").setGridParam({ sortorder: sortOrder })
}
any ideas?
Thanks!
You should use firstsortorder:'desc'
in the definition of every column of the colModel.
精彩评论