Search code examples
javascriptjquerykendo-uikendo-griddataitem

Kendo grid: Make multiple cells dirty in a row using jQuery


I have a batch editable grid. I modify the dataitems via jQuery, and mark the changed value as dirty like this: grid._modelChange({ field: "propertyName", model: dataItem}); The other way is the set() method: dataItem.set("propertyName","value"), but I don't use it because is extremely slow.

I want to mark multiple cells as dirty in a row, but when I mark the second field, the dirty mark of the first Prop disappears, and when mark the third field as changed, the dirty mark from the second field disappears, so only the third Prop becomes dirty.

The following loop does the dataItem update and marking the field as dirty:

            $(GridDataItems).each(function () {

                        this.Prop1 = false;
                        Grid._modelChange({ field: "Prop1", model: this });

                        this.Prop2 = "someValue";
                        Grid._modelChange({ field: "Prop2", model: this });

                        this.Prop3= "someOtherValue";
                        Grid._modelChange({ field: "Prop3", model: this });                                                
                }
            );

I need something like this:

Grid._modelChange({ field: "Prop1", model: dataItem },
                  { field: "Prop2", model: dataItem },
                  { field: "Prop3", model: dataItem });

Any ideas for the dirty marks not to disappear? Thanks.


Solution

  • I believe this is the correct behavior of a Kendo grid. Check this link out:

    http://www.telerik.com/forums/manually-updating-multiple-values#YfUbqGvY6UePysCKirK08A

    Check the article out, this talks about highlighting multiple cells with dirty flag:

    http://blog.codebeastie.com/kendo-grid-javascript-data-manipulation/