Hi,
I am creating a grid using row templates with custom upload and download buttons for individual rows.These buttons are anchor links with their class set to k-button. I am attaching a click handler to these buttons using the jquery delegate function. My code runs fine in chrome but when I try it ie9 nothing happens when I click the buttons. The weird thing is if start developer tools (by pressing F12) everything starts running fine. Can anyone explain what may be causing this issue. I am using the jquery.js files provided with kendo.
Code excerpts for reference as shown below
<!-- HTML code -->
<table id="grid">
<thead>
.....
</thead>
</table>
<script id="rowTemplate" type="text/x-kendo-tmpl">
<tr >
..
<td>
<a id="delete" class='k-button' data-event="delete"><span class='k-icon k-delete'>Delete</span></a>
<a id="download" class='k-button' data-event="download"><span class='k-downloadicon'>Download</span></a> </td>
</tr>
</script>
<script type="text/javascript">
$(function () {
$(document).ready(function () {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
...
},
destroy: {
...
}
},
....
});
$("#grid").kendoGrid({
dataSource: dataSource,
rowTemplate: kendo.template($("#rowTemplate").html()),
...
});
$(document).delegate(".k-button", "click", function (e) {
var that = $(this),
eventData = that.data("event");
if (eventData != null) {
_clickHandlers[eventData](e);
}
});
_clickHandlers = {
"delete": function (event) {
console.log("delete");
....
},
"download": function (event) {
console.log("download");
.....
}
}
});
});
</script>
I am creating a grid using row templates with custom upload and download buttons for individual rows.These buttons are anchor links with their class set to k-button. I am attaching a click handler to these buttons using the jquery delegate function. My code runs fine in chrome but when I try it ie9 nothing happens when I click the buttons. The weird thing is if start developer tools (by pressing F12) everything starts running fine. Can anyone explain what may be causing this issue. I am using the jquery.js files provided with kendo.
Code excerpts for reference as shown below
<!-- HTML code -->
<table id="grid">
<thead>
.....
</thead>
</table>
<script id="rowTemplate" type="text/x-kendo-tmpl">
<tr >
..
<td>
<a id="delete" class='k-button' data-event="delete"><span class='k-icon k-delete'>Delete</span></a>
<a id="download" class='k-button' data-event="download"><span class='k-downloadicon'>Download</span></a> </td>
</tr>
</script>
<script type="text/javascript">
$(function () {
$(document).ready(function () {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
...
},
destroy: {
...
}
},
....
});
$("#grid").kendoGrid({
dataSource: dataSource,
rowTemplate: kendo.template($("#rowTemplate").html()),
...
});
$(document).delegate(".k-button", "click", function (e) {
var that = $(this),
eventData = that.data("event");
if (eventData != null) {
_clickHandlers[eventData](e);
}
});
_clickHandlers = {
"delete": function (event) {
console.log("delete");
....
},
"download": function (event) {
console.log("download");
.....
}
}
});
});
</script>