Update transport doens't add parameter

3 posts, 0 answers
  1. Daniël
    Daniël avatar
    6 posts
    Member since:
    Sep 2012

    Posted 13 Feb 2013 Link to this post

    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. Daniël
    Daniël avatar
    6 posts
    Member since:
    Sep 2012

    Posted 13 Feb 2013 Link to this post

    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);
    }

  3. Sachin
    Sachin avatar
    2 posts
    Member since:
    Jun 2011

    Posted 25 Apr 2013 Link to this post

    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

Back to Top