I'm using a Kendo UI Grid that is changing the bg color of each row due to a condition in the databound event like this:
I have a custom column where 3 buttons are given to categorize. What I want to do now, is to change the background color of a row immideately, when one of these buttons is clicked. The background color changes, when the grid is reloaded, but this takes far too long 'cause the grid is filled with a lot of data. I only want to add e.g. the css class "green" to the affected row.
For example:
thanks in advance
function onDataBound(e) { var grid = $("#Software").data("kendoGrid"); var gridData = grid.dataSource.view(); for (var i = 0; i < gridData.length; i++) { var currentUid = gridData[i].uid; if (gridData[i].CategoryID == 1) { var currenRow = grid.table.find("tr[data-uid='" + currentUid + "']"); $(currenRow).addClass("green"); } else if (gridData[i].CategoryID == 2 ){ var currenRow = grid.table.find("tr[data-uid='" + currentUid + "']"); $(currenRow).addClass("red"); } else { var currenRow = grid.table.find("tr[data-uid='" + currentUid + "']"); $(currenRow).addClass("yellow"); } }}For example:
function SetGreen(sid, cid) { var grid = $("#grid").data("kendoGrid"); cid =1; var url = '@Url.Action("SetMethod","SetController")'; $.post(url, { SID: sid, CID: cid }); grid.saveChanges(); //right here I want to set the bg color for the affected row}