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

[Solved] GridView losing filtering options - Greetings and Salutations ;-)

1 Answer 124 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pat
Top achievements
Rank 1
Pat asked on 13 Jul 2011, 10:35 PM
Greetings and Salutations ;-)

I've got an interesting situation that I'm not sure I have any ability to resolve the way our webpage is constructed, so I though I'd give you the situation.  I've attached 4 png files that are in sequence order.

Capture 1 - shows a grid loaded with data, and selecting the filter option on a column shows all possibly items to filter in  that column.
Capture 2 - shows selecting one of the items in the filter and the grid changing accordingly.
Capture 3 - is a different grid shown in the same location of the first window.  All that is done is the first grid is hidden, and the second grid is set to visible. 
Capture 4 - is a return to the original grid with the same sequence of hidden and visible directives in reverse.  No changes have occurred to the underlining data of the first grid. 

So, the problem is that as can be seen by Capture 4, the selectable items now only allows one option, in this case option 5.  All the other items that were present in the filter from capture 1 are gone, even though the underlying data still contains all those other rows.
Is there a way to programmatically capture the selected filter item(s), and upon return to capture 1 reload all the data and then programmatically place the captured filtered item(s) back on? 

A couple of other facts, when I don't select a filter item and perform the same sequence everything works accordingly.  Additionally, if I select a Modal window from the first grid, and the grid from Capture 1 remains visible but in the background, when I return to grid 1 all filter options are available.  Even when I had selected an item in the filter window before transitioning to the Modal window.

So any suggestions or directions to information on the would be much appreciated.

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 14 Jul 2011, 06:51 AM
Hello Pat,

In fact, this has nothing to do with the showing and hiding of the grids.

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 filters have been applied. So when you click 5, only values of 5 are left in the grid and therefore the only distinct value is 5.

Of course, this behaviour can be easily changed. You have to attach to the DistinctValuesLoading event of the grid and tell it to load ALL distinct values and not only the ones that are currently in the view:

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

This false tells the grid to return ALL distinct values.
 
I hope this helps.

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

In case problems persist after this modification, we will need some kind of a dummy sample project that we can debug in order to see what exactly is going on.

Best wishes,
Ross
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
Pat
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or