FilterDescriptors with multiple OR filters

1 Answer 46 Views
ListView
Rodrigo
Top achievements
Rank 1
Iron
Iron
Iron
Rodrigo asked on 12 Mar 2024, 06:09 PM

Can I use FilterDescriptors with OR options?
Can you help me?

                this.FilterDescriptors.Add(new Telerik.Maui.Controls.Compatibility.DataControls.ListView.ListViewDelegateFilterDescriptor()
                {
                    Filter = new Func<object, bool>(
                        (item) => ((ListaTechnical)item).TagLogic.Contains(searchText) || 
                                  ((ListaTechnical)item).Equipment.Contains(searchText) ||
                                  ((ListaTechnical)item).Conjunto.Contains(searchText) ||
                                  ((ListaTechnical)item).Issues.Contains(searchText) ||
                                  )
                });

Regards,

Rodrigo.

 

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 13 Mar 2024, 09:24 AM

Hi Rodrigo,

You can filter the ListView data by adding a filter descriptor to the filter descriptors collection. Still the scenario you shared cannot be achieved as in this case you filter the data by 4 properties, but the first one will be with highest priority. You can test on your side and will see that the collection will be filtered by TagLogic property. This is how the built-in filter descriptor is designed and implemented.

Suggestion:

For your scenario I can suggest you directly work with the collection bound to the ListView, not with the FilterDescriptor. For example you can filter the data by using a LINQ query based on your custom case. 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
ListView
Asked by
Rodrigo
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Didi
Telerik team
Share this question
or