This is a migrated thread and some comments may be shown as answers.

Kendo Grid filter for Odata

1 Answer 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 13 Jul 2020, 07:47 AM
We are using Kendo Grid in Asp.Net MVC application. The grid is configured and mapped to a Odata WebAPI for server filter to a Odata controller. Currently, any filter on two or more than two columns works with AND condition for filter. I want to convert into OR instead of AND. How can I do that ?

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 14 Jul 2020, 02:08 PM

Hi, Amit,

You can override the filter logic operator in the dataSource.transport.read.data function:

.DataSource(dataSource => dataSource
   .Custom()
   .Type("odata")
        .Transport(transport =>
           transport.Read(read => read.Action("Read", "Home").Data("additionalData"))
        ) 
)
<script>
    function additionalData(options) {
        if(options.filter){
            options.filter.logic = "or";
        }
    }
</script>

https://dojo.telerik.com/@bubblemaster/uzoCEZEv

                        transport: {
                                read: {
                                  url:"https://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders",
                                  data: function(options){
                                    if(options.filter){
                                      options.filter.logic = "or";
                                    }
                                  }
                                }
                            },

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Tags
Grid
Asked by
Amit
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or