I'm implementing single row undo functionality (rather than cancelling all changes made in the grid). I have an image that will be clicked to trigger the undo:
Then some JavaScript that attaches the functionality to the img:
The bolded line clears the changes, but the grid is not updated unless I call the line that is commented out (grid.refresh()).
The problem is that calling .refresh clears the other rows' "dirty" indicator, which is problematic. Is there a way to refresh the UI for a single row? I thought by calling cancelChanges(dataItem), it would do that automatically for me.
Thank you!
columns.Template(@<text></text>).ClientTemplate("<img class='undoButton' style='width:16px;' src='Content/images/undo.png' />").Width(32);Then some JavaScript that attaches the functionality to the img:
<script type="text/javascript"> // Undo functionality $('#activity-grid').on('click', '.undoButton', function (e) { e.preventDefault(); //alert('undo'); var grid = $('#activity-grid').data().kendoGrid; var dataItem = grid.dataItem($(this).closest('tr')); dataItem.dirty = false; grid.dataSource.cancelChanges(dataItem); // works //grid.refresh(); // only way to show the changes in the UI });</script>The bolded line clears the changes, but the grid is not updated unless I call the line that is commented out (grid.refresh()).
The problem is that calling .refresh clears the other rows' "dirty" indicator, which is problematic. Is there a way to refresh the UI for a single row? I thought by calling cancelChanges(dataItem), it would do that automatically for me.
Thank you!