0

I'm trying to implement some functionality in "onchange" of text box in telerik kendo grid. But it is not firing in change; instead it's firing on onBlur.

The code is here. demo

Premkumar Jayaseelan
  • 681
  • 2
  • 10
  • 30

3 Answers3

0

To track the changes in the editors inside the column templates you should use different approach. Please check the example below:

 $("#grid").kendoGrid({
    columns: [ {
      field: "name",
      template: kendo.template($("#name-template").html())
    }],
    dataSource: {
      data: [ {id: 1,  name: "Jane Doe" }, {id: 2, name: "John Doe" } ],
      //schema is required for enabling valid CRUD operations
      schema: {
        model: {
          id: "id",
          fields: {
            id: {type: "number"},
            name: {type: "string"}
          }
        }
      }
    }
  });

  var grid = $("#grid").data("kendoGrid");

  grid.table.on("change", "input", function(e) {
    alert("change");

    //optionally update the underlying model:
    var editor = $(this);
    var dataItem = grid.dataItem(editor.closest("tr"));
    dataItem.set("name", editor.val());
  });

Another option is to use the MVVM approach shown in the following demo:

Vladimir Iliev
  • 1,871
  • 16
  • 26
0

I've used "onkeyup" event. It works :)

Premkumar Jayaseelan
  • 681
  • 2
  • 10
  • 30
0

You should try "onkeypress" event. It will work as per your requirement.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Deepak Kushvah
  • 278
  • 2
  • 12