Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: two columns sorting

two columns sorting 1 year 1 month ago #118

  • cnpphani
  • cnpphani's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Karma: 0
Hi

I have 10 columns in my jqgrid so my question is out of 10 columns two columns are require asennding order sroting depends on due date order id will display asendning order

means primary sorting is due date and secondary sorting is order id.
can you please tell me how to do in jqgrid

two columns sorting 1 year 1 month ago #119

  • positron
  • positron's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Thank you received: 4
  • Karma: 1
You should have your grid defined as:

$("#yourTableID").jqGrid({
......
multiSort:true
sortname: 'dueDate asc, orderID',
sortorder: 'asc',
...........
colModel: [
{name: 'dueDate ', ......},
{name: 'orderID', ......}
],
............
});

Please, pay attention that the ascending sort on the orderID is actually specified in the sortorder parameter. In general the default sort order of the last column mentioned in the sortname list is specified in the sortorder parameter and not in the list itself.

Now that sorting will work out of the box for local data only. It will just get the sort icons displayed on the columns for datatype xml or json. If you are using any of these two, i.e. server data, you'll have to sort your data on the server before sending it back to jqGrid. Luckily the sidx URL param contains the sort clause so that your server code knows which columns to sort on.

two columns sorting 1 year 1 month ago #120

  • Cerberus
  • Cerberus's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 55
  • Thank you received: 3
  • Karma: 0
Here is a demo of multi-column sorting in jqGrid - codemerx.com/jqgrid/demos/jqgrid-standal...multi-column-sorting
  • Page:
  • 1
Time to create page: 0.271 seconds