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]