简体   繁体   中英

Custom Sorting on JqGrid Group

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM