Kendo 模板不工作
Kendo template not working
我的Javascript
(function () {
var viewModel = kendo.observable({
dataEntryStyle : "block",
productsDatasource: new kendo.data.DataSource({
})
});
kendo.bind($("#consumable"), viewModel);
})();
Html -
<script type="text/x-kendo-template" id="testTemplate">
<span data-bind="text: dataEntryStyle"></span>
</script>
<div id="consumable" data-template="testTemplate"></div>
此模板似乎不起作用,我希望看到 "block" 作为输出,但它是空白的。
将源绑定到 HTML 元素
(function() {
var viewModel = kendo.observable({
dataEntryStyle: "block",
productsDatasource: new kendo.data.DataSource({})
});
kendo.bind($("#consumable"), viewModel);
})();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2016.1.112/js/kendo.all.min.js"></script>
<div id="consumable" data-template="testTemplate" data-bind="source:dataEntryStyle"></div>
<script type="text/x-kendo-template" id="testTemplate">
<span data-bind="text: dataEntryStyle"></span>
</script>
我的Javascript
(function () {
var viewModel = kendo.observable({
dataEntryStyle : "block",
productsDatasource: new kendo.data.DataSource({
})
});
kendo.bind($("#consumable"), viewModel);
})();
Html -
<script type="text/x-kendo-template" id="testTemplate">
<span data-bind="text: dataEntryStyle"></span>
</script>
<div id="consumable" data-template="testTemplate"></div>
此模板似乎不起作用,我希望看到 "block" 作为输出,但它是空白的。
将源绑定到 HTML 元素
(function() {
var viewModel = kendo.observable({
dataEntryStyle: "block",
productsDatasource: new kendo.data.DataSource({})
});
kendo.bind($("#consumable"), viewModel);
})();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2016.1.112/js/kendo.all.min.js"></script>
<div id="consumable" data-template="testTemplate" data-bind="source:dataEntryStyle"></div>
<script type="text/x-kendo-template" id="testTemplate">
<span data-bind="text: dataEntryStyle"></span>
</script>