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

Kendo Web UI Grid poup editing with ApiController

0 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Darryl
Top achievements
Rank 1
Darryl asked on 09 Oct 2012, 05:19 AM
I downloaded and modified the KendoGridWebAPI sample project and modified the grid to have popup editing rather than batch in line.

The api controller (ValuesController) was designed to handle collections for the update and delete operations and so I regenerated a standard api controller against the Product entity to manage updates and deletes for a single Product

The update (PUT) no longer worked complaining of a null "id" parameter ...
public HttpResponseMessage PutProduct(int id, Product product)

After changing the function to ...
public HttpResponseMessage PutProduct(Product product)

and the parameterMap from ...
parameterMap: function (data, operation) {
                        if (operation != "read") {
                            return kendo.stringify(data.models);
                        }
                    }

to ...

parameterMap: function (data, operation) {
                        if (operation != "read") {
                            return kendo.stringify(data.models[0]);
                        }
                    }

things began to work as expected.

This doesn't really follow REST protocol but how do you do a standard REST update with the ID on the path?

update: {
    url: "api/values/5",
    type: "PUT",
    contentType: 'application/json;charset=utf-8' 
},

and what should the parameterMap look like?

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Darryl
Top achievements
Rank 1
Share this question
or