Bind event to element returned to column.template

2 posts, 1 answers
  1. Matjaž
    Matjaž avatar
    74 posts
    Member since:
    Jul 2015

    Posted 14 Sep Link to this post

    I need column with checkboxes as column content. I found this code.

    My template:

        field : "Select",
        template: (dataItem) =>
            return `<input type="checkbox" />`;

    But how can I track when input checked is changed? Is it possible to return JQuery instead of string? I need to react immediately after checked is changed. Example in code I found use another event to check checkboxes checked property.

  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    1748 posts

    Posted 16 Sep Link to this post

    Hi Matjaž,

    You can attach event handler directly to the checkboxes as shown in the following dojo example:
    As you will notice, within the dataBound event we are attaching the handlers:
    dataBound: function(e){
        e.sender.element.find(".sel").bind("click", checkBoxCheck);

    You can also add a handler in the input element directly: 
    template: "<input type='checkbox' class='sel' onclick='someFunction(this,ev);' />"

    Hope this helps.

    Konstantin Dikov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top