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

Kendo UI Grid update only changed cell/column

2 Answers 970 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dron
Top achievements
Rank 1
Dron asked on 22 Apr 2019, 09:36 AM

When performing an update on the grid it sends all column data.

How can I Send only changed (with dirty class) data?

2 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 22 Apr 2019, 03:28 PM
Hello Dron,

There is no built-in functionality that will pass only the changed values of the model, but you could handle the "parameterMap" of the dataSource to modify the returned data. You can then find the corresponding items (using the ID field) in the dataSource.view() collection and get reference to the "dirtyFields" collection, where you will find all changed fields. Using the model in the event handler and the dataItem from the dataSource (and the dirtyFields collection), you can return the stripped model:

Best Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Dron
Top achievements
Rank 1
answered on 23 Apr 2019, 07:57 AM

I wrote this code and its work as I need. 

parameterMap: function(options, operation) {
var idCode = 'CargoID';
if (operation === "update") {
var res = grid.data("kendoGrid").dataSource.view();
var dirtyFields = {};
for (var i = 0; i < res.length; i++) {
if (res[i].dirty === true) {
dirtyFields[res[i][idCode]] = {};
$.each(res[i]['dirtyFields'], function(index, value) {

if (res[i][idCode] === options[idCode]) {
dirtyFields[res[i][idCode]][index] = res[i][index];
}
});

}
}
  return dirtyFields;
}
}

 

This is suboptimal code. I wrote it last night after my main job. But it works.

Спасибо, Костян, за помощь. Будешь в Москве - пиши. С меня пиво!

 

Tags
Grid
Asked by
Dron
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Dron
Top achievements
Rank 1
Share this question
or