Kendo Window Attach Event to HTML Element Inside Template

Untuk kasus Kendo Window dengan content dari template, misalnya

[code language=”javascript”]
<script id="notifyHRTemplate" type="text/x-kendo-template">
<p>
<a href="javascript:" class="btn btn-primary send-notification">Send Notification to HR</a>
<a href="javascript:" class="btn btn-default close-window">Cancel</a>
</p>
<table class="table table-bordered">
# for (var i = 0; i < data.length; i++) { #
<tr>
<td>#= data[i].Name #</td>
<td>#= data[i].Status #</td>
</tr>
# } #
</table>
</script>

$(‘#window’).kendoWindow({
title: self.options.title,
width: 650,
visible: false,
modal: true,
content: {
url: self.options.bindingUrl,
dataType: ‘json’,
template: kendo.template($(‘#notify-hr-template’html()),
}
});
[/code]

Jika ingin meng-attach event pada tombol ‘.send-notification’, caranya sbb

[code language=”javascript”]
$(‘#window’).data(‘kendoWindow’).bind(‘refresh’, function (e) {
var win = this;

$(‘.send-notification’).click(function () {
self.sendNotification();
})
})
[/code]

Chandra Oemaryadi has written 244 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>