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

Filterpredicate with Advanced Filter

I have some data which consists of years from 2017 to 2019. Lets say the data is as so, 

List<data> list = new List<data>();
list.Add({Year = 2017, ID = 1000});
list.Add({Year = 2017, ID = 1022});
list.Add({Year = 2018, ID = 1023});
list.Add({Year = 2018, ID = 1234});
list.Add({Year = 2019, ID = 1034});
list.Add({Year = 2019, ID = 1001});

I would like to perform an initial filter at start based on the selected year. In this case I run an filterpredicate at runtime.

sfDataGrid1.Columns["Year"].FilterPredicates.Add(new FilterPredicate() { FilterType = FilterType.Equals, FilterValue = 2017, PredicateType = PredicateType.And });

Which gives me the correct result. The issue comes when I try to use the advanced filter function checkboxes in the sfDataGrid, it just doesnt work. It either check boxes random entries and doesn't filter anything. For instance if I deselect all items in the advanced filter and just select ID = 1000, it would not update.

Any help would be appreciated.

3 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team April 24, 2019 06:25 AM

Hi Julius, 

Thanks for using Syncfusion product. 

We have checked the reported issue in our end with preparing the simple sample. But we could not able to reproduce the issue in our end, please find the sample and video which we tried. 

Please let us know Syncfusion version which you are used and provide the replication procedure if we missed anything in video. It will be helpful to provide the solution at earliest. 


JU Julius April 24, 2019 10:19 AM

Based on review, it was the filterpredicate predicate type that caused the issues. When I was trying to run a predicate with both 2018 and 2017, the PredicateType.And or Predicate.Or will not work. I had to do the following with the PreidicateType:

            var init = true;
            for (var x = 1; x < checkBoxComboBox12.CheckBoxItems.Count; x++)
                if (checkBoxComboBox12.CheckBoxItems[x].CheckState.ToString().Equals("Checked"))
                    var c = new FilterPredicate();
                    c.FilterValue = checkBoxComboBox12.CheckBoxItems[x].ComboBoxItem;
                    c.FilterBehavior = FilterBehavior.StringTyped;
                    c.FilterType = Syncfusion.Data.FilterType.Contains;
                    c.PredicateType = init ? PredicateType.And : PredicateType.Or;
                    init = false;

JP Jagadeesan Pichaimuthu Syncfusion Team April 25, 2019 06:35 AM

Hi Julius, 

Thanks for your update. 

We have tried to reproduce the reported issue based on the provided details, but still we could not able to reproduce it in our end. We have modified the sample and prepared the video for your reference. 

If still the problem exists, kindly reproduce the problem in the provided sample and revert us (or) send your sample that replicating the problem or provide the replication procedure if we missed anything in video. This would be a very helpful for us to investigate the reported problem at our end and provide the solution at earliest. 

Live Chat Icon For mobile
Up arrow icon