javascript - Kendo Grid equivalent of onEditComplete -
is there event equivalent oneditcomplete kendo grid event fires after content of cell has been edited?
documentation mentions "edit" event, fires cell goes edit mode (so equivalent onbeginedit).
the closest event desired behavior found "save" event, event fires when content of cell has been changed. want event fires cell goes out of edit mode.
the grid's editmode set incell.
so due comment i've removed previous answer - using blur event on input boxes (or other elements) seems work :
on grid.edit event, use jquery bind textbox (or other inline edit control)'s blur event fired when focus lost. append grid definition...and replace alert code.
edit: function (e) { alert('edit fired'); $('input.k-input.k-textbox').blur(function () { alert('blur event called'); }); },
i've tested modifying sample inline edit code here
my full local source of edit - see edit event on grid def:
<div id="example" class="k-content"> <div id="grid"></div> <script> $(document).ready(function () { var crudservicebaseurl = "http://demos.kendoui.com/service", datasource = new kendo.data.datasource({ transport: { read: { url: crudservicebaseurl + "/products", datatype: "jsonp" }, update: { url: crudservicebaseurl + "/products/update", datatype: "jsonp" }, destroy: { url: crudservicebaseurl + "/products/destroy", datatype: "jsonp" }, create: { url: crudservicebaseurl + "/products/create", datatype: "jsonp" }, parametermap: function (options, operation) { if (operation !== "read" && options.models) { return { models: kendo.stringify(options.models) }; } } }, batch: true, pagesize: 20, schema: { model: { id: "productid", fields: { productid: { editable: false, nullable: true }, productname: { validation: { required: true } }, unitprice: { type: "number", validation: { required: true, min: 1 } }, discontinued: { type: "boolean" }, unitsinstock: { type: "number", validation: { min: 0, required: true } } } } } }); $("#grid").kendogrid({ datasource: datasource, pageable: true, height: 430, toolbar: ["create"], // added in hook here bind edit element events. // blur fired when element loses focus edit: function (e) { alert('edit fired'); $('input.k-input.k-textbox').blur(function (e) { alert('blur event called'); }); }, columns: [ "productname", { field: "unitprice", title: "unit price", format: "{0:c}", width: "100px" }, { field: "unitsinstock", title: "units in stock", width: "100px" }, { field: "discontinued", width: "100px" }, { command: ["edit", "destroy"], title: " ", width: "172px" }], editable: "inline" }); }); </script> </div>
Comments
Post a Comment