0
votes

I'm trying to use the Dynamic Linq Helper libraries from Kendo. The parameter map function on the grid does not have the correct parameters to send to the controller.

The parameterMap options have: {"take":10,"skip":0,"page":1,"pageSize":10}

but according to the example, it should have take, skip, sort, filter, which is not in the parameterMap function or getting passed to the server.

I'm following the example here

http://www.telerik.com/blogs/kendo-ui-open-sources-dynamic-linq-helpers

And also looked other examples, my grid is set up the same as the others.

The only difference being, this is a Web API single page app, not MVC. However, this shouldn't make a difference in what the Grid class is passing to it's parameterMap function.

What is going on here?

$("#grid").kendoGrid({

dataSource: {
   transport: {
                read: {
                    url: "http://localhost/biahost/query/projectStatuses",
                    dataType: "application/json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8"
                    //data:{}
                },
                parameterMap: function (options) {
                    debugger;
                     //options only contain    {"take":10,"skip":0,"page":1,"pageSize":10}
                    return kendo.stringify(options);
                }
            },
            schema: {
                data: "Data",
                total: "Total",
                model: {
                    fields: {
                        NAME: { type: "string" },
                        CODE: { type: "string" },
                        STATUS: { type: "string" },
                        COMMENTS: { type: "string" },
                        INSERTS: { type: "string" },
                        UPDATES: { type: "string" },
                        TOTAL_UPDATES: { type: "string" },
                        LAST_ACTION_DATE: { type: "string" }

                        //UnitId: { type: "string" },
                        //UnitName: { type: "string" }
                    }
                }
            },
            pageSize: 10,
            serverPaging: true,
            serverFiltering: true,
            serverSorting: true
        },
        filterable: true,
        sortable: true,
        pageable: true,
        columns: projectStatusColumns
    });


var projectStatusColumns = [
           {
               field: 'NAME',
               label: 'Res name',
               hidden: true,
           },
           {
               field: 'CODE',
               label: 'Code'
           },
           {
               field: 'STATUS',
               label: 'Status'
           },
           {
               field: 'COMMENTS',
               label: 'Comments'
           }
           ,
           {
               field: 'INSERTS',
               label: 'Inserts'
           }
           ,
           {
               field: 'UPDATES',
               label: 'Updates'
           }
           ,
           {
               field: 'TOTAL_UPDATES',
               label: 'Total Updates'
           }
           ,
           {
               field: 'LAST_ACTION_DATE',
               label: 'Last Action Date'
           }
        ];
1

1 Answers

0
votes

had the same problem so i looked it up and here i am. You just need to return "options" which contains the parameter map as it is, if you stringify it will become a json object which cannot be defined in a url. Hope i'm not too late!