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

Update transport doens't add parameter

2 Answers 146 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniël
Top achievements
Rank 2
Daniël asked on 13 Feb 2013, 11:31 AM
I'm using the following code for my transport options of a kendo grid
transport: {
    create: {
        // get the rid off of the model object that
        // kendo ui automatically passes to the url function
        url: function () {
            return "/project/creategebouw/"
        },
        dataType: "json",
        type: "POST",
        contentType: "application/json; charset=utf-8",
        data: { Project: { Id: PID } },
        complete: function () { onCreateGebouw(); },
    },
    read: {
        url: function () {
            return "/project/FindAllGebouwen/"
        },
        dataType: "json",
        type: "POST",
        contentType: "application/json; charset=utf-8",
        data: { Project: { Id: PID } }
    },
    update: {
        // get the rid off of the model object that
        // kendo ui automatically passes to the url function
        url: function () {
            return "/project/editgebouw/"
        },
        dataType: "json",
        type: "POST",
        contentType: "application/json; charset=utf-8",
        data: { Project: { Id: PID } },
        complete: function () { onGebouwUpdate(); }
    },
With the read option, Project { Id : 2 } is neatly added tot the JSON data that is created through the parametermap (just a JSON stringify return) but this is not the case with the update option, why? is this a bug?
I tried putting the adding of the project id in the parametermap but I can't seem to get that to work, any examples?

2 Answers, 1 is accepted

Sort by
0
Daniël
Top achievements
Rank 2
answered on 13 Feb 2013, 12:19 PM
I managed to solve it with:

parameterMap: function (data, type) {
     if (type == "create" || type === "update"){
         data = { Project: { Id: PID }, Gebouw: data };
     }
     return JSON.stringify(data);
}
0
Sachin
Top achievements
Rank 1
answered on 25 Apr 2013, 01:27 PM
Hello Daniel

Could you share your contact details?

Or please contact me at sachinkumark@gmail.com

I would like to get your inputs on updating data from grid via controller

Thanks
Sachin
Tags
Grid
Asked by
Daniël
Top achievements
Rank 2
Answers by
Daniël
Top achievements
Rank 2
Sachin
Top achievements
Rank 1
Share this question
or