ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: rsgmedia on April 07, 2017, 05:06:52 pm

Title: Sorting One column Based on the value of another(hidden) column
Post by: rsgmedia on April 07, 2017, 05:06:52 pm
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.
Title: Re: Sorting One column Based on the value of another(hidden) column
Post by: paramvir 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