We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Toggle between FilterBar and regular Filters in GridDataControl columns

I have a checkbox intended to switch between using the FilterBar and the regular funnel filters in my grid.
It is working when it comes up initially (with the FilterBar) and when I first switch back to regular filters.
But when I check the box again to show FilterBar, it quits working correctly.
The UI always changes to show the right thing, bar or funnels, but the filter text I type in doesn't do anything anymore.

The XAML is like this:
   <syncfusion:GridDataControl  x:Name="runDataGrid"  
                AllowEdit="False"
                AutoPopulateColumns="False"
                AutoPopulateRelations="False"
                ColumnSizer="Auto"
                AllowDelete="False"
                EnableContextMenu="False"
                IsDynamicItemsSource="True"
                EnableTriStateSorting="True" 
                NotifyPropertyChanges="True"
                ShowAddNewRow="False"
                ShowTooltips="True"
                ShowFilters="True"
                ShowFilterBar="{Binding IsChecked,
                               ElementName=ShowFilterBar,
                               Mode=TwoWay,
                               UpdateSourceTrigger=PropertyChanged}"

                ShowFilterStatusMessage="{Binding IsChecked,
                                          ElementName=ShowMessage,
                                          Mode=OneWay,
                                          UpdateSourceTrigger=PropertyChanged}"

                UpdateMode="PropertyChanged"

.............. ....
                        <CheckBox x:Name="ShowFilterBar"
                                  Margin="5"
                                  IsChecked="True">
                            Show Filter Bar
                        </CheckBox>
                   
I implemented event handlers for checked / unchecked events, but I'm not sure what they need to do to reset the filter handling.

        void ShowFilterBar_Checked(object sender, RoutedEventArgs e)
        {
            ClearFilters();
            runDataGrid.ShowFilterBar = true;
        }


7 Replies

SP Sowndaiyan Paulpandi Syncfusion Team February 10, 2016 10:49 AM UTC

Hi Steve,

Thanks for contacting Syncfusion Support.

In GridDataControl you can clear filter collection by using the GridDataVisibleColumn.
Filters.Clear method like the below code example,


C#


        foreach(var column in this.dataGrid.VisibleColumns)

            {

                column.Filters.Clear();

            }



We have prepared
a sample for switch the FilterBar and the regular funnel filters using the CheckBox and you can download the same from the below location. In this sample filtering is working fine from our side. If this solution does not meet your requirement could you please share the exact requirement of GridDataControl filtering in your application. It will be helpful for us to analyze further. 

Sample : http://www.syncfusion.com/downloads/support/forum/121931/ze/FilterBar_Demo1416789228


Please r
efer the below UG link for know more about the Filtering


UG Link :
http://help.syncfusion.com/wpf/griddata/data-presentation#filters-collection

Regards,

Sowndaiyan



SM Steve McWilliams February 10, 2016 02:59 PM UTC

OK, your sample has the same problem as my project does.

To reproduce it, let's use the State Name column. 
First, pick Alabama from the drop-down list on the filter bar; this should filter the list to Alabama records only.
Then, go back to All states.
Now, uncheck the Show Filter Bar checkbox.
Select  the Alabama checkbox in the drop-down list; again, it should filter correctly and show Alabama records.
Now check Select All box again, and full list of records should be shown.

But, if you check the Show Filter Bar box again, although the view switches to display the filter bar, picking something from the drop-down list does not filter anything, neither does typing something like 'A%' in the filter bar header box.



SP Sowndaiyan Paulpandi Syncfusion Team February 11, 2016 11:23 AM UTC

Hi Steve,

We have checked your reported issue with our sample. But we were unable to reproduce the issue. Filtering operations is working fine when we switch the FilterBar and regular filters. For your reference, we have attached the tested video in the below location. Could you please revert by modifying the previous updated sample based on your application and share the details about which Syncfusion Version you have used in your application. It will be helpful for us to analyze further. 

Video :  http://www.syncfusion.com/downloads/support/forum/121931/ze/Filter-1568422022


Regards,

Sowndaiyan.



SM Steve McWilliams February 11, 2016 10:01 PM UTC

I modified my project a little to be as close to yours as possible, but I still get same behavior.

I attached a video of how your example behaves for me (apologies for trial version overlay).
The second time I use the filter bar it no longer filters the data, although the filter status message indicates the correct thing.

I use VisualStudio 2013, but I have an older version of Syncfusion (Essential Studio 10.3.0.43 ), which is probably the problem.

Attachment: ScreenCaptureProject1_e86fd251.7z


SP Sowndaiyan Paulpandi Syncfusion Team February 12, 2016 09:07 AM UTC

Hi Steve,


We were able to reproduce your reported  “Filtering operations” issue in Version 10.3.0.43. We have already fixed this issue and this fix was included in our 13.4.0.53 version. So we recommend you to upgrade to the latest version to get the issue fixed.


Regards,

Sowndaiyan



SM Steve McWilliams February 12, 2016 04:08 PM UTC

Thanks. I will see if I can do that.


SP Sowndaiyan Paulpandi Syncfusion Team February 16, 2016 03:51 AM UTC

Hi Steve,

Thanks for the update.

Please let us know if you need further assistance.
Regards,
Sowndaiyan

Loader.
Up arrow icon