ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: mikep on May 27, 2023, 05:33:34 pm

Title: Sort Blank cells at the end on ascending
Post by: mikep on May 27, 2023, 05:33:34 pm
I have a number/int column and I'd like the rows with no data to be sorted last, rather than first, in the ascending sort.
Title: Re: Sort Blank cells at the end on ascending
Post by: paramvir on May 29, 2023, 10:43:00 pm
Please use custom sorting:

Code: [Select]
sortType: function (rowData1, rowData2, dataIndx) {
                    var c1 = rowData1[dataIndx],
                        c2 = rowData2[dataIndx];

                    if (c1 > c2 || c1 == null) {
                        return 1;
                    }
                    else if (c1 < c2 || c2== null)  {
                        return -1;
                    }
                    else {
                        return 0;
                    }
                }
Title: Re: Sort Blank cells at the end on ascending
Post by: mikep on May 31, 2023, 09:56:19 pm
thank you that works. However when clicking the column header to sort, the columns are sorted in 4 different ways: ascending, descending, custom sort asc, custom sort descending. is there a way to only apply the custom sort when sorting ascending, so the user only toggles between 2 sorts: custom asc, and descending
Title: Re: Sort Blank cells at the end on ascending
Post by: paramvir on June 01, 2023, 05:13:30 pm
Please set sortModel.cancel to false.

https://paramquery.com/pro/api#option-sortModel