Note that there are some explanatory texts on larger screens.

plurals
  1. POKendo UI Grid Editor Complete
    primarykey
    data
    text
    <p>I have a Kendo Grid, where I have defined an Editor like this:</p> <pre><code> @(Html.Kendo().Grid(Model.Data) .Name("GridINT") .Editable(editable =&gt; editable .Mode(GridEditMode.PopUp) .TemplateName("MyTemplateName") .Window(w =&gt; w.Width(500)) .Window(w =&gt; w.Title("My Template"))) </code></pre> <p>Before I engage the editor, I bind a mouseup handler to the rows, and I tweak the style of the command button. When the editor closes, whether by Submit, Cancel, or 'X', my handler and style tweaks are gone for the affected row. I need to restore them, but I haven't found the valid event. I have bound the cancel click event like this:</p> <pre><code> $('.k-grid-cancel').bind('click', function ( e ) { colorCommandCells(); }); </code></pre> <p>but if I restore my handler/style to a grid row here, the editor's closing process undoes what I have done.</p> <p>Bottom line: how can I know that the editor is finished updating the grid (which it does, as I have described, even if the editor is cancelled) and which row was the one that the editor messed with?</p> <p>This is the code that colors the command cells:</p> <pre><code> function colorCommandCells() { // This block colors the command cell according to ISNEW. It must run every time the DataBound event occurs. var grid = $("#GridINT").data("kendoGrid"); var gridData = grid.dataSource.view(); for (var i = 0; i &lt; gridData.length; i++) { var currentUid = gridData[i].uid; var currentRow = grid.table.find("tr[data-uid='" + currentUid + "']"); var editButton = $(currentRow).find(".k-grid-edit"); var aColor = gridData[i].ISNEW == 1 ? "#FFCCFF" : "transparent"; var aText = gridData[i].ISNEW == 1 ? "Add" : "Edit"; var parent = $(editButton).closest("td"); $(parent[0]).css('background-color', function () { return aColor; }); editButton[0].innerHTML = "&lt;span class=\"k-icon k-edit\"&gt;&lt;/span&gt;" + aText; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload