Author Topic: Sorting One column Based on the value of another(hidden) column  (Read 2103 times)

rsgmedia

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
I have a pqGrid whose first column which is hidden has numbers in increasing order(0,1800,3600), i have a second column which is not hidden, I want to sort my grid when i click my second column but it should be based on the values of first hidden column.

If you wanna know::
My second column contain time of every half hour from 6 am to 6 am(6:00 AM, 6:30 AM.....12:30 PM......5:30 AM), and the fist hidden column contain the time in seconds passed from 6:00 AM.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Sorting One column Based on the value of another(hidden) column
« Reply #1 on: April 07, 2017, 06:44:24 pm »
Please use custom sorting on 2nd column.

Code: [Select]
sortType: function(rd1, rd2){
  return rd1[ dataIndx_of_first_column ] - rd2[ dataIndx_of_first_column ];
}

https://paramquery.com/pro/api#option-column-sortType

Example: https://paramquery.com/pro/demos/sorting_custom