C1FlexGrid - sorting on group aggregate + keeping other sorting order on detail

Posted by: michal.chudzik on 25 October 2020, 9:13 pm EST

  • Posted 25 October 2020, 9:13 pm EST

    Lets say I have grid with columns: Name and Price.
    Rows are grouped by Name.
    When I click on "Name" column I want to sort group rows by Name, but I want rows under group to be sorted always by Price Ascending.
    How can I accomplish that?
  • Marked as Answer

    Replied 26 October 2020, 5:40 pm EST

    Hi Michal,

    You can use SortDescriptions to add sorting on the Price column whenever a group is created for the Name column as follows:

    // Fires whenever a group is changed
    private void GroupDescriptionsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    // Checking if a group is added on Name property
    if(e.Action == NotifyCollectionChangedAction.Add && (e.NewItems[0] as PropertyGroupDescription).PropertyName == "Name")
    // Adding ascending sort for price column
    _flexGrid.CollectionView.SortDescriptions.Add(new SortDescription()
    Direction = ListSortDirection.Ascending,
    PropertyName = "Price"

    Please refer the attached sample for the same. (see FlexGridSorting.zip)

    Please let us know if you need any further assistance.


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels