最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Kendo Grid add new record event,how to catch it? - Stack Overflow

programmeradmin1浏览0评论

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 user8643848user8643848
Add a ment  | 

1 Answer 1

Reset to default 5

You 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

发布评论

评论列表(0)

  1. 暂无评论