I modified the code, but now I got two buttons. The one using the data-template is working the work I wanted, but it's NOT in the toolbar of the grid. How do I get the template in the toolbar to work (response to the value of CanVoid when changed).
Thanks,
html
<div id="demo-grid">
<div data-template="detail-template" data-bind="source:this, enabled: CanVoid"></div>
<script id="detail-template" type="text/x-kendo-template">
<div>
<button id="asdf" type="button" data-bind="click:test, enabled: CanVoid">Void</button>
</div>
</script>
</div>
Javascript
vm = kendo.observable({
CanVoid: false,
test: function(){
alert("Hello there!");
}
});
kendo.bind($("#demo-grid"),vm);
var ds = new kendo.data.DataSource({
data: [
{name: "Joe", phone: "212-555-1234"},
{name: "Sally", phone: "212-999-7785"},
{name: "Bill", phone: "212-244-7035"}
]
});
var scholarGrid = $("#demo-grid").kendoGrid({
filterable: false,
dataSource: ds,
//detailTemplate: kendo.template($("#detail-template").html()),
toolbar :kendo.template($("#detail-template").html()),
columns:[{field: 'name', title:'Name'},
{field: 'phone', title: 'Phone'}]
}).data("kendoGrid");