1. 程式人生 > >獲取kendo treeView上的選中項

獲取kendo treeView上的選中項

    function getTreeSelectedIds() {
        var parentIds = [];
        var tree = $("#treeView").data("kendoTreeView");
        for (i = 0; i < tree.items().length; i++) {
            var checkbox = $(tree.items()[i]).find(":checkbox");
            var isChecked = checkbox[0].checked;
            
if (isChecked) { var id = tree.dataItem($(tree.items()[i])).id; parentIds.push(id); } } _selectedparentIds = parentIds; return parentIds; }