Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Listgrid: sorting of groups in listgrid

    Hi,
    When I group by a certain field I noticed that the groups are not sorted by their group title. See attached screenshot. I guess the groups are in order of their first occurrence in the underlying record set.

    Is there a way that I can sort the groups by their group value after the groupBy has been executed?

    gr. Martin

    #2
    Hi,
    A trick I tested was to sort the records by the group by field before the grouping is done. This seems to work fine.

    Does this indeed make sense, or is there a reason not to sort the group headers this way?

    Thanks!

    gr. Martin

    Comment


      #3
      Since the groups are formed based on the current sort order, the order of the groups represents the order in which each group value was encountered according to the current sort, and the order within the groups represents the sort order, and we think both behaviors are desirable.

      As you mentioned, the user can sort by the group field to get groups in order of the group field.

      Comment


        #4
        Hi, we give users the ability to group by columns that are not currently visible in the grid. And, we want the grid to automatically sort by the grouped column first even if it isn't a visible column in the grid. I've tried to patch your groupBy function to always sort by the grouped column first and then sort by other sorted columns after that. But, the patch has become unwieldy and it not always working as expected. Is it possible to provide an option at the grid level to control how this sorting behavior works? As you mentioned, both behaviors could be desirable.

        Comment


          #5
          Could you characterize exactly what behaviors you want?

          For example, should this sort be shown in the ListGrid headers and shown in the multi-sort dialog, or should it be implicit?

          If the user sorts while grouped, does that override the sorting by groupValue or is it added on top?

          Providing a proposed name for this new property might also help to clarify what you're looking for.

          Comment


            #6
            We'd prefer it to be implicit and not shown in the multi-sort dialog. And, there would be no way to override the behavior by sorting on a column. The sort would still sort by the grouped column first. So, the new sort the user chooses would always be "added on top".

            You could call it "sortByGroupFirst" ?

            Comment

            Working...
            X