JavaScript Displaying dirty cell triangle on grid when changing datasource manually

I have a kendo grid with custom popup edit window to imitate popup edit, but with batch edit. Everything works fine, but I am experiencing a small issue. Whenever value is changed, the grid cell does not have that red triangle thingy in the corner indicating that this particular value different from original.

As I understand in this post, manually made changes in datasource does not appear on the grid, so I have to add them manually.

This post 'manually maintain dirty cell marker on paging in Kendo grid' gives an idea how to get it working. I could attach some listeners to kendoWindow inputs, track what fields are being edited, compare old and new values...

But is there a less painful way to achieve this functionality? Maybe there is some built in kendo function to achieve that?

Here's a small working example http://dojo.telerik.com/aSaXe/4

Answer:1

The red "dirty" marks appear automatically only when the built-in in-cell editing is used. From this point of view, your scenario requires these to be added manually after the custom editing popup is closed.

You may find the change event of the data item useful in the task. It will be fired each time a value in the popup is changed and the respective textbox is blurred.

var uid = $(e.target).parents('tr').attr('data-uid');
var grid = $('#grid').data("kendoGrid");
var dataItem = grid.dataSource.getByUid(uid);

dataItem.bind("change", function(args) {
  // args.field
});

Finally, keep in mind that each change in the Grid dataSource causes the whole table to be redrawn (unless the built-in in-cell editing is used), so you will lose any previously applied custom styling.

Answer:2

I am setting up foundations for a websocket app using node.js, express and socket.io. I decided it would be elegant to place the code that sets up socket.io in a separate module, so my server.js file ...

I am setting up foundations for a websocket app using node.js, express and socket.io. I decided it would be elegant to place the code that sets up socket.io in a separate module, so my server.js file ...

When I refresh page timer is reset. I would like to set localStorage on this timer, how do it set in localStorage HTML 00 : <span id="timer">02 : 00</span> JavaScript :- window.onload ...

When I refresh page timer is reset. I would like to set localStorage on this timer, how do it set in localStorage HTML 00 : <span id="timer">02 : 00</span> JavaScript :- window.onload ...

I have a page with a background image and six tiles that are links, All of those are contained in a <div id = "main">. I also have a side navbar that pushes the content to the right when clicked ...

I have a page with a background image and six tiles that are links, All of those are contained in a <div id = "main">. I also have a side navbar that pushes the content to the right when clicked ...

I am working on Angular2 project and got an issue that Chrome caches HTML templates. It is not a problem for the development since I can make cache to be ignored in Chrome Dev mode. But it is a real ...

I am working on Angular2 project and got an issue that Chrome caches HTML templates. It is not a problem for the development since I can make cache to be ignored in Chrome Dev mode. But it is a real ...