Possible solution - but not very:
$('#grid').jqGrid('setGridParam', {sortname: 'id', sortorder: 'asc'}).trigger('reloadGrid', [{page: 1}]); $('#gbox_grid .s-ico').css('display','none'); $('#gbox_grid #jqgh_grid_id .s-ico').css('display',''); $('#gbox_grid #jqgh_grid_id .s-ico .ui-icon-triangle-1-s').removeClass('ui-state-disabled');
as shown here
http://jsfiddle.net/qhYLT/
Another way to sort by column programmatically is by specifying the order:
$('#grid').jqGrid('setGridParam', {sortorder: 'desc'}); $('#grid').jqGrid('sortGrid', 'id');
SortGrid launches a reboot for you. This would not be complete without a demo: http://jsfiddle.net/uTqD5/
The third time, lucky! Undocumented function:
$('#grid').jqGrid('sortGrid', 'id', '', 'asc');
source share