0
votes

I am using kendo grid and its build-in functionality for creating and updating items.

I'm looking for a way to change Editor labels (title and buttons Update/Cancel).

enter image description here

I found an answer here (Change Button text in Kendo Ui Grid Popup Window) where OnaBei explains how to change title.

However, I still cannot figure out the way to change button names based on whether item is being added or being edited. The same with title, is it a way to change it based on "create"/"update" state?

I assume that it can be done with javascript, but it will probably be a hack and dirty solution.

1

1 Answers

3
votes

This can be done in the edit event of the grid. The model event argument has a isNew method which will return true in "create" state. Here is some sample code:

  edit: function(e) {
    var title = "Edit mode";

    if (e.model.isNew()) {
       title = "Insert mode";
    }

    var wnd = e.container.data("kendoWindow");
    wnd.title(title);
  }

And a live demo: http://jsbin.com/USUpAZUT/1/edit