Author Topic: empty cells and sorting  (Read 2621 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
empty cells and sorting
« on: March 03, 2016, 04:25:31 pm »
hello

I have som empty cells in a column with datatype "integer"...these are not correctly sorted and mixes with '0' values in a not wanted way...is there a solution for this?

thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: empty cells and sorting
« Reply #1 on: March 03, 2016, 11:57:14 pm »
The other way is to use custom sorting:

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

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: empty cells and sorting
« Reply #2 on: March 06, 2016, 02:04:45 am »
thanks, however tried:

Code: [Select]
...
sortType: function(rowData1, rowData2, dataIndx){
        //compare rowData1[dataIndx] and rowData2[dataIndx]
var c1 = rowData1[dataIndx],
                        c2 = rowData2[dataIndx]
                        //c1 = $.trim(val1).length,
                        //c2 = $.trim(val2).length;

                    if (c1 > c2) {
                        return 1;
                    }
                    else if (c1 < c2) {
                        return -1;
                    }
                    else {
                        return 0;
                    }
but can't get it to work...im not sure I understand how to implement it...

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: empty cells and sorting
« Reply #3 on: March 07, 2016, 12:39:09 pm »
Sorry about that.

Custom sorting works only with strings, it has been corrected in upcoming version v3.3.0 ( hopefully would be launched by end of this week )