Skip to content

Grid is sorted after grouping & ungrouping #5711

@dKab

Description

@dKab

See this plunker http://plnkr.co/edit/RqIItEtFTXe6k6U8kwiT?p=preview

Column Name is not sorted initially.

  1. Group by Name column
  2. Ungroup Name

Grid is sorted.
This may be undesirable behaviour - I would expect grid to return to the state that it was in, before I grouped and ungouped it.
The clearGrouping method description says:

Doesn't remove sorting, as we don't know whether that sorting was added by grouping or was there beforehand

Here's the code that adds sorting ( groupColumn method):

 // add sort if not present
    if ( !column.sort ){
      column.sort = { direction: uiGridConstants.ASC };
    } else if ( typeof(column.sort.direction) === 'undefined' || column.sort.direction === null ){
      column.sort.direction = uiGridConstants.ASC;
    }

Maybe we could save previous sort state of the column before we add our sort. We could add some fileld like previousSort on the column object and apply it when we remove grouping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions