开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜