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

Extend grid parameterMap in Asp MVC context

2 Answers 368 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 24 Dec 2012, 10:57 PM
Hi!

I have a serverbound (ajax) grid and want to add a custom argument when fetching data.

After some searching I found the option to alter the parameterMap function. However, when I try to extend that function I extend the original functionality, not the one provided by kendo.aspnetmvc.js. This means that my custom argument works, but sort/filter/... does not anymore. When I remove my code sort/filter/... works but of course my custom data does not get through.

Is there any way to add my custom argument? Below is the code I tried for reference:
$("#myGrid").data("kendoGrid")
    .dataSource.transport.parameterMap = function (data, operation) {
        return $.extend(data, {
            myCustomData: true  //Actually client-side calculated data, not static
        });
    };



Thanks
/Victor

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 26 Dec 2012, 07:30 AM
Hello Victor,

 The officially supported way to send additional data is documented here.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Victor
Top achievements
Rank 1
answered on 26 Dec 2012, 07:59 PM
Thanks so much for that, much better solution!

For others looking I after some digging found that it can also be configured on the dataSource like this

$("#myGrid").data("kendoGrid")
    .dataSource.transport.options.read.data = function (e) { ...}


Thanks again Atanas!
/Victor
Tags
Grid
Asked by
Victor
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Victor
Top achievements
Rank 1
Share this question
or