3 Replies Latest reply on Aug 22, 2008 1:02 PM by Mitek17

    Applying a filter to a dataProvider doesn't change the selectedItems of a grid!

      1. We have an AdvancedDataGrid that is binded to a 10 items ArrayCollection as its dataProvider.

      2. We select all the items in the grid using the mouse.

      3. We apply a filter to the ArrayCollection (the dataProvider). The grid is updated visually, now let's say only 5 items are shown (the items respecting the filter). This is the expected behavior.

      4. We then access the property "selectedItems" of the dataGrid: it returns 10 items, not 5!!

      This has *a lot* of impact on our code!

      Our workaround is to validate that each item in the selectedItems is also in the dataProvider once we need them. We are also considering overriding "selectedItems" so it automatically checks if all the items in selectedItems are in the dataProvider.

      We know that the filtered items are still present in the "source" property of the ArrayCollection when a filter is apply. But, pratically, those filtered items are not in the ArrayCollection anymore and shouldn't be present in the "selectedItems" of the grid, in our opinion. If they are not shown visually, why would they be present in selectedItems?

      Any idea, thoughs?