FlexGrid Sort Unexpected Behaviour

Posted by: james on 13 February 2024, 4:25 pm EST

  • Posted 13 February 2024, 4:25 pm EST

    We experience some weird behaviour is using sort with a FlexGrid, so I made a sample to see if I could reproduce the weirdness. In doing so, I was able to find a way around the issue, but I think there may be something going on.

    To be specific, the problem is that when you click a different column to sort it selects that column as #2 in the sort sequence, instead of only sorting by that column. (as if you had held down Ctrl, but you didn’t)

    There are many ways I was able to produce the weird behaviour, the following is 1 of these ways:

    1. Launch my sample App.

    2. User click on column header “Description” which will sort the grid by “Description” (expected behaviour).

    3. Click on button “Sort” which calls grid.Sort(SortFlags.Ascending, 1); This will sort the grid by column 1. (expected behaviour).

    4. User click on column header “Description”. This adds Description as #2 in the sort, and does not remove column 1. Column 1 and Description are now part of the sort columns – as if the user held down “Ctrl” but they didn’t. (unexpected behaviour) .

    Way Around the Issue

    I found that if I call c1FlexGridMultiRange.SortDefinition = null; before calling Sort then the issue does not happen.

    Personally I don’t think this is by design due to the order of events, so I thought I would raise the issue.

    As mentioned, the issue also occurs in other scenarios - one of which is if I use Sort initially on the BindingSource, and I don’t use flexgrid.sort at all… the user gets the issue when they start clicking columns to sort. So it occurs even if .Sort is not used programmatically, but the BindingSource has a sort preconfigured before binding to the grid.

    FlexGridSortTest.zip

  • Posted 14 February 2024, 5:53 pm EST

    Hi James,

    Thank you for providing the sample project and detailed steps. We could see the behavior you mentioned on our end. We have shared all the observations with the development team to get their insights on it and will let you know the updates as soon as possible.

    [Internal Tracking ID: C1WIN-31659]

    Best Regards,

    Kartik

Need extra support?

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

Learn More

Forum Channels