ParamQuery grid support forum
General Category => ParamQuery Pro Evaluation Support => Topic started by: rickpqu on August 12, 2015, 07:06:35 pm
-
Hi, in my ParamQuery table, one column has numbers and blanks. When I sort this column, blank cells appear at the top, and then number cells sorted accordingly. Is there a way to make the number cells to show at the top and the blank cells at the bottom after sorting (both ascending and descending)?
-
It can be done in either of 2 ways.
1) Custom sorting. http://paramquery.com/pro/demos/sorting_custom
or
2) Take out the rows with blank values in beforeSort event and append them in sort event.
Similar example: http://paramquery.com/pro/demos/freeze_rows
-
Thanks. I tried custom sorting, and I could push null cells to the bottom at ascending sorting. However, when I click the column header again for descending sorting, the null cells came to the top, followed by the highest value cells. I guess that descending sorting just reverses the result of ascending sorting - is there a way to custom sorting for both ascending and descending sorting? I am afraid that the option 2) you suggested might take too much time.
-
Custom sorting column.sortType is called during both ascending and descending order.
you might need to set a flag in beforeSort(evt, ui) event during descending order. you can find the current sorting order from ui.sorter[0].dir
http://paramquery.com/pro/api#event-beforeSort
In sortType callback do the reverse when one of the values is blank and sorting is in descending order.
-
Thanks. I could solve the problem with using ParamQuery Pro 3's sortModel.sorter and custom sorting (sortType).