This is a migrated thread and some comments may be shown as answers.

Bind event to element returned to column.template

1 Answer 421 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Seyfor
Top achievements
Rank 1
Seyfor asked on 14 Sep 2016, 02:15 PM

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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 16 Sep 2016, 08:47 AM
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.


Regards,
Konstantin Dikov
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Seyfor
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or