I have a Kendo Grid (MVC) that has multiple Columns.
I have a use case where if Column 1 is edited, the value of Column 2 may change server-side. I'm not seeing the modified values in the grid though.
My Update API handles all of this and returns the updated row. But with inline editing, it seems that if I update Column 1, the other columns aren't refreshing after the Update is finished. So I (the user) has to manually refresh the Grid in order to see Column 2 correctly modified.
What am I doing wrong?
StackOverflow thread with same question: https://stackoverflow.com/q/47354235/590774
Feel free to answer anywhere.
5 Answers, 1 is accepted
In scenarios where the value in column 2 has to be changed after a change in column 1, the value in column 2 has to be changed on the server. Then the response from the server should contain the newly modified model with the new values for column 1 and 2.
For example, the Grid is sending value 10 for column 1, then on the Action in the controller to make a calculation based on that value 10 and set the column 2 value to the desired one.
I made a test scenario on my end and it was working as expected:
https://www.screencast.com/t/0QVAJAnnEC
If additional assistance is needed on this matter please provide a runnable example and I will gladly provide a suggestion best suited for it.
Regards,
Stefan
Progress Telerik

Stefan,
Thank you for your reply.
A couple of questions.
1. Why did you use a POST instead of a PUT? Is that necessary?
2. I am using WebAPI controllers for the services, not MVC as in your example.
3. What does your Grid MVC layout code look like? Perhaps something is wrong with mine that I am not seeing.
I ask these questions because my service looks very similar to yours and it does not seem to be working correctly.
I am wondering what else factors into my issue.
Thank you,
Issa Fram
Regarding the questions:
1) Using PUT instead of POST should not cause an issue if the WepAPI is reading the parameters correctly.
2) If a WebApi is used I can suggest checking the following resources and a runnable example:
https://docs.telerik.com/aspnet-mvc/helpers/grid/how-to/editing/incell-batch-editing-webapi
https://docs.telerik.com/aspnet-mvc/helpers/grid/editing/webapi-editing
https://developer.telerik.com/products/crud-with-asp-net-mvc-web-api-ef-and-kendo-ui-session-recording/
3) The Grid layout is the same as in our demo which I used for reference:
http://demos.telerik.com/aspnet-mvc/grid/editing-inline
Regards,
Stefan
Progress Telerik

Stefan,
One of the links you sent: https://github.com/telerik/ui-for-aspnet-mvc-examples/blob/master/grid/grid-web-api-crud-incell/KendoUIMVC5/Controllers/ProductsController.cs#L74
This Put method is doing the following:
return Request.CreateResponse(HttpStatusCode.OK);
So the updated fields never get returned. Just an OK status goes back to the grid.
Your other example:
http://demos.telerik.com/aspnet-mvc/grid/editing-inline
The EditingInine_Update method is doing the following:
return
Json(
new
[]{product}.ToDataSourceResult(request,ModelState));
That is not WebAPI but that really shouldn't matter.
In my code (WebAPI) I am using
return
this
.Request.CreateResponse(HttpStatusCode.OK, updatedProductModel);
This isn't working. Not updating the other columns in the Grid. Only the originally edited column (Column1).
What does it seem that I am doing wrong? Am I supposed to return an array? Am I supposed to use the DataSourceRequest in the WebAPI method?
Thank you,
Issa Fram
Indeed for the update, only a status code is returned, but for Create and Delete the actual item is returned.
Please refer to the POST and DELETE methods for the syntax.
var response = Request.CreateResponse(HttpStatusCode.Created,
new
DataSourceResult { Data = products });
// This is the example for Create. In the update example, modify the producs and return the modifed record
As if we may be missing a small detail, please provide a runnable example where I can test the scenario and provide a suggestion best suited for it.
Regards,
Stefan
Progress Telerik