2016-09-23 80 views

回答

0

如果您已經複選框列表呈現,然後使用MVVM 檢查結合:

http://demos.telerik.com/kendo-ui/mvvm/elements

http://docs.telerik.com/kendo-ui/framework/mvvm/bindings/checked

如果你想渲染JavaScript的複選框列表,根據一些數據,同時勾選複選框,然後使用Kendo UI 模板kendo.render()

http://docs.telerik.com/kendo-ui/framework/templates/overview

http://docs.telerik.com/kendo-ui/api/javascript/kendo#methods-render

<ul id="checkboxList"></ul> 

<script> 

var template = kendo.template("<li>" + 
    "<label>" + 
     "<input type='checkbox' #: isChecked ? \" checked='checked'\" : \"\" # />" + 
     "#: name #" + 
    "</label>" + 
"</li>"); 

var data = [ 
    { id: 1, name: "foo", isChecked: true }, 
    { id: 2, name: "bar", isChecked: false } 
]; 

var html = kendo.render(template, data); 
$("#checkboxList").html(html); 

</script> 

相反的kendo.render(),您也可以使用一個劍道UI 的ListView和項目模板。模板定義本身可以是相同的。

http://demos.telerik.com/kendo-ui/listview/index

http://docs.telerik.com/kendo-ui/api/javascript/ui/listview#configuration-template

相關問題