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

Filter not working for Kendo Grid with Dynamic LINQ Helpers

4 Answers 525 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Umair
Top achievements
Rank 1
Umair asked on 07 Mar 2016, 08:40 AM

So I was playing around with KendoUI and incorporated Dynamic LINQ Helpers in my ASP.NET MVC project. I followed the small tutorial here.
So far, the paging and sorting is working fine but the filtering is not working. Every time I try to filter my records, there is an exception on server side like the following
Operator '=' incompatible with operand types 'String' and 'String[]'
Can anyone help me with this?
Here is my Grid code (yes I am using Angular)

 

$scope.mainGridOptions = {
            dataSource: {
                transport: {
                    read: {
                        url: ConfigData.BaseUrl + "ChartOfAccounts/GetData",
                        type: 'post',
                        dataType: "json"
                    },
                    update: {
                        url: ConfigData.BaseUrl + "ChartOfAccounts/UpdateData",
                        type: "post",
                        dataType: 'json'
                    },
                    create: {
                        url: ConfigData.BaseUrl + "ChartOfAccounts/CreateData",
                        type: "post",
                        dataType: 'json'
                    },
                    destroy: {
                        url: ConfigData.BaseUrl + "ChartOfAccounts/DeleteData",
                        type: "post",
                        dataType: 'json'
                    }
                },
                serverPaging: true,
                serverFiltering: true,
                serverSorting: true,
                pageSize: 5,
                batch: true,
                schema: {
                    data: "Data",
                    total: "Total",
                    model: {
                        id: "ID",
                        fields: {
                            ID: { type: "number" },
                            AccountNumber: { type: "string" },
                            AccountName: { type: "string" }                               
                        }
                    }
                }
 
            },
            columns: [
                { field: "AccountNumber", title: "Account Number", width: "130px" },
                { field: "AccountName", title: "Account Name", width: "130px" }
            ]
 
        };
    

4 Answers, 1 is accepted

Sort by
0
Umair
Top achievements
Rank 1
answered on 07 Mar 2016, 08:42 AM

Here is the server side code

var chartofAccounts = DataStore.ChartOfAccounts.AsQueryable().ToDataSourceResult(request);
return Json(chartofAccounts, JsonRequestBehavior.DenyGet);

The DataStore is simple a static class containing static list of ChartOfAccounts

0
Daniel
Telerik team
answered on 09 Mar 2016, 05:45 AM
Hello,

Could you clarify which tutorial have you followed? The example that we have with dynamic linq and MVC posts the state as JSON in order to correctly deserialize the filters on the server.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Umair
Top achievements
Rank 1
answered on 09 Mar 2016, 07:28 AM

I am not using MVC wrappers. I don't want to use MVC wrappers. I want to work with KendoUI and Angular. The Dynamic LINQ helpers are throwing exception when I filter the records. The example you provided doesn't help

 

0
Daniel
Telerik team
answered on 11 Mar 2016, 06:17 AM
Hello again,

The example that I linked does not use the MVC wrappers but the JavaScript initialization:
$(function () {
    $("#grid").kendoGrid({
        ...
The configuration when using angular will be the same. 

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Umair
Top achievements
Rank 1
Answers by
Umair
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or