Search code examples
jqgridjqgrid-formatter

jqgrid: how to sort on a different column


I have a column "Amount" on the jqGrid. When I click on top of "Amount" column, the grid needs to be sorted by another column called "Amount Payable".

How can I achieve this.

Thanks, Sam


Solution

  • If you define the onSortCol function you could test for the column being sorted and then change the value.

    Ex.

    onSortCol: function (index, iCol, sortorder) {    
        if(index === "Amount"){
            index = "AmountPayable";              
        }
    },