Author Topic: Sorting within the group  (Read 2760 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Sorting within the group
« on: March 05, 2018, 08:07:32 am »
Hi.

Is it possible to sort records withing the group without sorting the group headers? Say i have group 1 with 5 records and group2 with 3 records, on click on headers i want to sort only group 1 not group 2 when single: true?

group1
  record 1
  record 2
  record 5
  record 3
  record 4
group2
  record 1
  record 2
  record 5
  record 3
  record 4

Want to sort only group1 and final result is expected (ascending/descending)-

group1 (header1)
  record 1
  record 2
  record 3
  record 4
  record 5
group2 (header2)
  record 1
  record 2
  record 5
  record 3
  record 4

sorting of group headers is not expected.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Sorting within the group
« Reply #1 on: March 05, 2018, 10:48:24 am »
Records are sorted in context of some specific field, your illustration is not clear enough to me.

Could you please provide an illustration from a live example.

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Re: Sorting within the group
« Reply #2 on: March 05, 2018, 01:16:35 pm »
Please find the below jsfiddle link.

http://jsfiddle.net/h4rmbx70/40/

We have 2 groups,  Group1 and Group2, on click Profits and Dept, rows withing the group are sorted which is expected but groups are sorting (asc/desc) is strange.

1. Our requirement is to keep Group1 always on top and sorted its rows asc. (click on Revenues field).
2. Is it possible to sort only Group1 rows, not Group2 rows. Currently Rows within the Group2 are also sorted.



paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Sorting within the group
« Reply #3 on: March 06, 2018, 12:13:49 am »
Please let me know whether it works for you.

http://jsfiddle.net/h4rmbx70/65/

Code: [Select]
sortModel:{
      sorter:[ { dataIndx: "company", dir: "up" } ],     
      single: false,
      number: false,
      multiKey: null
    },

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Re: Sorting within the group
« Reply #4 on: March 06, 2018, 08:03:26 am »

Thanks for the solution.

As specified, we wanted it to be worked when single: true. Also when sorted, group 2 remain unsorted.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Sorting within the group
« Reply #5 on: March 07, 2018, 09:48:22 am »
Sorry  I don't see any option to enable sorting on 2 columns ( first fixed one on group column i.e., company, and second on any other column ) with single: true. It works with single: false only.

Secondly it's not feasible to sort records in one group and ignore records in any other group. All the records are sorted.

I'm still looking for any available workaround to meet your requirements and would let you know as soon as I found one.