Filter not working for Kendo Grid with Dynamic LINQ Helpers

5 posts, 0 answers
  1. Umair
    Umair avatar
    6 posts
    Member since:
    Feb 2016

    Posted 07 Mar 2016 Link to this post

    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" }
                ]
     
            };
        

  2. Umair
    Umair avatar
    6 posts
    Member since:
    Feb 2016

    Posted 07 Mar 2016 in reply to Umair Link to this post

    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

  3. Daniel
    Admin
    Daniel avatar
    2231 posts

    Posted 08 Mar 2016 Link to this post

    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!
     
  4. Umair
    Umair avatar
    6 posts
    Member since:
    Feb 2016

    Posted 09 Mar 2016 in reply to Daniel Link to this post

    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

     

  5. Daniel
    Admin
    Daniel avatar
    2231 posts

    Posted 11 Mar 2016 Link to this post

    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!
     
Back to Top