0

I am using JQGrid with grouping. I am having Grouped Data something like this.

Test0001
     name description date response
                      date response

Test00011
     name Description date response
                      date response
                      date response
Test0002
     name Description date rersponse

I want to sort group header, currently it has been sort as a sting, but I want to remove prefix and then I want to sort it as int. So output would be first Test0001 ,Test0002 then Test00011. So is there any way to add custom sort on groups

Cœur
  • 37,241
  • 25
  • 195
  • 267
Pavan Tiwari
  • 3,077
  • 3
  • 31
  • 71
  • Do you use *client side* sorting, server side sorting or mixed (in case of remote `datatype` and `loadonce: true`)? Which `datatype` you use? If you use *client side* grouping then jqGrid makes sorting of the column with `Test0001`, `Test0002`, `Test00011`. In the case you can define `sorttype` as function to solve the problem. – Oleg Mar 12 '15 at 07:40

1 Answers1

0

If you use client side sorting then you can solve the problem by adding sorttype defined as function. It allows to replace original data of the column to another one during sorting only. For example you can parse input value of sorttype in two parts, convert the second part to integer and construct another normalized string which you return from sorttype. It's enough that Test0001, Test0002, Test00011 will be converted to Test0001, Test0002, Test0011 (the last item contains less 0 characters before 11). See the old answer for the code example.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798