Hi! I have some troubles with the Filter Selections in xamPivotGrid.
I use the methods provided in your samples to save/load views and it works very well, except one bug with the filters. Way to reproduce:
- Open any view, select some Filter Values:
- Save the view
- reopen (load) the view.
- Click on the Filter's handle to open the Filter list -> The saved selections have been restored and all values are right-> everything seems to be fine:
- Click on Cancel (or on the Filter's handle again) to close the Filter list.
- Click on the Filter's handle again to open the Filter list -> Suddenly ALL items are selected:
Code used to select filters on load (taken from your example on how to load/save views):
foreach (IFilterViewModel filterViewModel in dataSource.Filters)
{
while (filterViewModel.FilterMembers == null)
System.Threading.Thread.Sleep(100);
}
if (filterViewModel.FilterMembers != null)
foreach (IFilterMember filterMember in filterViewModel.FilterMembers)
SelectMembers(filterMember);
where selectmembers looks like:
private void SelectMembers(IFilterMember filterMember)
if (filterMember.FilterMembers != null)
foreach (IFilterMember subFilterMember in filterMember.FilterMembers)
SelectMembers(subFilterMember);
XamPivotGridData.CustomDictItem tmpItem = GetCustomDictItem(CurrentPivotGridData.FilterMembersToLoad, filterMember.Member.UniqueName);
if (tmpItem != null) { filterMember.IsSelected = tmpItem.Value; }
Thanks in advance,
Daniel
Hi,
Glad to have helped. Thanks very much for posting your conclusion. Other people may find it helpful.
Hi Marianne,
Thank you very much for your sample.
I compared your solution with mine and the only relevant difference i could find was that i set the selection using:
filterMember.IsSelected = Value;
whilst you used:
filterMember.FilterSource.IsSelected = Value;
And that did the trick! Thank you very much!
I created my own sample from the xamPivotGrid’s Save and Load Views in the feature browser. My data is generated flatdatasource. I tried to comment the code that is used to create the flatdata from the Save/Load class.
I couldn’t find any code that matched yours exactly. There are some subtle differences which may relate to your design.
When I tried to repeat your steps I could not create the behavior that you described where all the items are selected. It sounds as if the filters were not saved or were not loaded correctly.
I’m attaching my sample.
Please let me know if you continue to have the same behavior using my sample. Perhaps I didn’t get the steps exactly right.
Note: If i click on "OK" instead of "cancel" after loading/opening filter everything works fine and i'm not able to reproduce this error anymore (At least until I load the view the next time)-