Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1530
Selection gets lost after clearing filter
posted

Hi,

our customer reported an annoying problem to us related to XamDataGrid.

Hers's the situation:

  1. The grid contains thousands of records.
  2. The user sets a filter to find a special record.
  3. Once he found it he selects it by clicking on it.
  4. To see the record in it's context, he clears the filter what causes the selection to be removed from the selected record.

Why does this happen??

I would understand a de-selection of records taht are invisible due to filter values, but there's no reason to de-select in case of clearing filters.

How can we preserve the selection?

Best regards

cew3

Parents
No Data
Reply
  • 34430
    Verified Answer
    Offline posted

    Hello cew3,

    I have been investigating into this behavior you are reporting with lost selection when clearing filters, and I have reproduced it. It appears that this is happening as the "FilterRecord" is essentially trying to steal the selected status of the grid. For example, if you were to hold the Ctrl or Shift key down with multiple selection active in the XamDataGrid, you would retain your selection.

    Another workaround in this case would be to cache the selected records, possibly by listening to the SelectedItemsChanged event of the XamDataGrid and accessing the XamDataGrid.SelectedItems.Records collection. In doing this, you could also listen to the RecordFilterChanged event of the grid and check the e.RecordFilter.Conditions collection to see if it is empty (where e is the event arguments) to potentially catch a filter clearing. If you catch this, and the cached record(s) are not null, you can then push them back into the XamDataGrid.SelectedItems.Records collection.

    I have attached a sample project demonstrating this workaround.

    This is unexpected behavior, and as such, I have asked our engineering staff to examine it further. To ensure it receives attention, I have logged the issue in our internal tracking systems with a development ID of 251493. I have also created a private support case for you so that you can track the progress of this issue and be notified when a fix becomes available. This support case has an ID of CAS-194895-T2Z3K5 and you can access it after signing into your Infragistics account at https://www.infragistics.com/my-account/support-activity.

    Please let me know if you have any other questions or concerns on this matter.

    XDGFilterSelectionCase.zip

Children