In kendo grid add new record has a event as following:
if (e.model.isNew())
but for this I have to write it inside "edit:",is there any other function or way I can use it outside of grid scope?
In kendo grid add new record has a event as following:
if (e.model.isNew())
but for this I have to write it inside "edit:",is there any other function or way I can use it outside of grid scope?
Share Improve this question edited Sep 4, 2019 at 12:14 DontVoteMeDown 21.5k10 gold badges72 silver badges113 bronze badges asked Sep 24, 2017 at 15:48 user8643848user86438481 Answer
Reset to default 5You can always bind the edit
event after the initialization and handle the create there. Note that the documentation says the edit
event handles both create and edit, so there is no create
event in the widget, only edit
:
function grid_edit(e) {
if (!e.model.isNew()) {
// Disable the editor of the "id" column when editing data items
var numeric = e.container.find("input[name=id]").data("kendoNumericTextBox");
numeric.enable(false);
}
}
$("#grid").data("kendoGrid").bind("edit", grid_edit);
Demo