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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Filterpredicate with Advanced Filter

Thread ID:

Created:

Updated:

Platform:

Replies:

144187 Apr 24,2019 01:55 AM UTC Apr 25,2019 11:35 AM UTC WinForms 3
loading
Tags: SfDataGrid
Julius
Asked On April 24, 2019 01:55 AM UTC

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.Clear();
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.

Jagadeesan Pichaimuthu [Syncfusion]
Replied On April 24, 2019 11:25 AM UTC

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. 

Regards, 
Jagadeesan 


Julius
Replied On April 24, 2019 03:19 PM UTC

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;
                    sfDataGrid7.Columns["ear"].FilterPredicates.Add(c);
                }
            }

Jagadeesan Pichaimuthu [Syncfusion]
Replied On April 25, 2019 11:35 AM UTC

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. 
 
Regards, 
Jagadeesan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon