In our software, it is possible to save the gridsettings, which also includes the filtersettings.
For providing nice filtering, we are using the FilterUIProvider of Infragistics, which shows the filtering criterias, like in the following picture (I apologize, it's German):
However, if I try to load the FilterSettings from the database into the grid, the Checked Items of the FilterUIProvider do not change (!)
This is the codesnippet I am having (Loading the FilterSettings):
For Each FilterSetting As GridFilter In CurrentVorlage.VorlageData.GridFilterSettings If Not FilterSetting.Key.Equals(.Key) Then Continue For Dim cond As New FilterCondition cond.CompareValue = FilterSetting.CompareValue //value from database cond.ComparisionOperator = CType(FilterSetting.ComparisionOperator.FilterComparisionOperator) //value from database e.Layout.Bands(0).ColumnFilters(.Key).FilterConditions.Add(cond) e.Layout.Bands(0).ColumnFilters(.Key).LogicalOperator = CType(FilterSetting.LogicalOperator, FilterLogicalOperator) Next
The rows in the grid are filtered out as expected, though. The only problem is that the FilterUIProvider seems deaf to the filtersettings changes. So if the user clicks on the Filter again, all items are unchecked. And if the User checks something else on the filter, the FilterSettings are gone, too.
What am I missing that the items are checked / unchecked according to the GridFilterSettings?
Version we are using: NetAdvantage 2009.2
Hi Fabian,
Can I assume that the data you are reading from the database is the same data that was written into the database when you saved the settings?
If so, then either you are missing some small piece of information that the filter provider needs, or else this is just a bug in how the filter provider interprets the filters. It's hard to say without knowing what the actual data is.
Basically, though, the filter provider doesn't have any way of remembering what the user checked in the dropdown. It applies the filters to the grid and then when you drop it down again, it looks at those filters and tries to interpret them. So if the settings you are loading are exactly the same as the ones that were created when the user dropped down the filter ui then it should work. Maybe something is changing - maybe the values are getting boxed or they are no longer the same data type.
It's also possible that the interpretation isn't perfect. I know for certain that there were some bugs in it that were fixed in later versions of the product.
If you could provide a small sample project that demonstrates the issue, I'd be happy to check it out for you. You need not include a database, you could simple step through your code and create a sample that sets the filters to some literal values in code that are the same as the values in your database.
Hi Mike,Thank you for your quick answer.
Finally I attached you a small example, where I try to save and load the filtersettings into the grid.Via Save-Button you can save the current filter settings to the filesystem, and if you restart the program, it will try to load the saved settings into the grid.As mentioned, the main problem we are having is that the FilterUIProvider does not tick the same checkboxes again. Instead, it adds the filters to the custom filter.Maybe this helps you along with what we are trying to achieve.Let me know if you need further information.kind regards,Fabian
Your sample is working fine for me. When I run the sample the first time, it comes up with two filters (Blanks) and 36. When I drop down the Filter UI, those are the two items checked on the list. I tried changing the filtered items and clicking the Save button, then stopping and re-running the app, and once again, it's working fine. The items I selected are still filtered and they are still checked on the list when I drop it down.
So my guess is that this is just a bug in the version you are using and you need to get the latest service release.
How to get the latest service release - Infragistics Community