This is a migrated thread and some comments may be shown as answers.

Column Filter - selection is being cleared

3 Answers 155 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Artur Romanowski
Top achievements
Rank 1
Artur Romanowski asked on 09 Jun 2011, 10:41 AM
Hi,

We have a problem with the grid filters when using the IsFilterable property.

Here are the steps:

1. we select a ColumnFilter using the small icon on top of the column - the filtered records appear.
2. we select several records from this filtered list
3. we change the filter to any other of which output does not contain the previously selected records.

At this moment the selection we made is cleared leaving us with SelectedItems.Count == 0. Therefore we cannot use filters more then once to select records from different categories.

Please supply solution to this issue.

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 14 Jun 2011, 08:29 AM
Hi Artur Romanowski,

Actually, this is a feature called "Cascading Distinct Values". In other words, the distinct values that you see at any moment are the ones that are left after all other filters have been applied. 

Of course, this can be turned off. I have attached a sample project that demonstrates how to do this. Here is the important part:

private void radGridView_DistinctValuesLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDistinctValuesLoadingEventArgs e)
{
    e.ItemsSource = ((RadGridView)sender).GetDistinctValues(e.Column, false);
}

I hope this helps.

Please, let me know if I have misunderstood your requirement and this is not what you would like to achieve.

Best wishes,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Artur Romanowski
Top achievements
Rank 1
answered on 15 Jun 2011, 10:17 AM
Hi, thanks for your reply.

I have looked through your example and even in it - the issue I've described is present.

Here's a way to reproduce:
Step 1: select a filter - for example Position = GK
Step 2: select any record (eg Manuel Almunia)
Step 3: select additional filter - eg Position = FW   (now you have Position = GK or Position = FW both selected)
Step 4: deselect Position = GK (at this point your filter is only Position = FW)
Step 5: deselect Position = FW (all filters are deselected now - all records should be visible)

Look at Manuel Almunia - the record is not selected. Im using SelectionMode="Multiple" and if I play with filters in a way described above the selection is constantly being cleared.
0
Accepted
Rossen Hristov
Telerik team
answered on 15 Jun 2011, 12:05 PM
Hi Artur Romanowski,

Now I see what you mean. This behavior is by design and cannot be otherwise. Selection is always applied over the current view only. If someone disappears from the current view, i.e. he is being filtered out, his selection is lost forever and there is no automatic way to bring it back.

You will have to write some custom code that saves the current selection and then tries to restore it back. You can use RadGridView's Selection API combined with the Filtering and Filtered events.

I hope this helps.

Kind regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Artur Romanowski
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Artur Romanowski
Top achievements
Rank 1
Share this question
or