简体   繁体   中英

Kendo UI Manually set cell dirty indicator

I am manually changing some things in a DataSource and setting the property .dirty = true, and it is behaving correctly on refresh, but not putting up the red dirty triangle in my grid. Is there a good way to do this manually other than actually pushing in an element myself?

var item = gridDataSource.get(id);
item.dirty = true;
item.SomeOtherlId = 5;
kendoGrid.refresh();

Like I said, everything is behaving correctly, I am just not getting the red dorito and would prefer not jamming it in with JavaScript if there is a better way. Thank you.

Looking at the kendo js file, it seems that the k-dirty-cell gubbins is applied in the change handler. However, the handler is only attached when the cell is in edit mode (as far as I can make out).

You might consider that the proper way to deal with this would be to put the cell in edit mode and then call trigger on the change event. I couldn't get it to work and frankly it's a massive PITA finding the cell to pass to editCell().

Instead, you could call the handler function directly. A bit of a hack perhaps but that seems to be par for the course with these widgets.

item.SomeOtherlId = 5;
grid._modelChange({ field: "SomeOtherId", model: item });

dojo example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM