如何在kendo树视图中启用和禁用复选框?

时间:2015-04-07 14:19:27

标签: javascript angularjs checkbox kendo-ui kendo-treeview

我有一个逻辑,当用户选择父我想要禁用子节点时,所以当我选择父复选框时,以下实现所有父母和孩子都禁用。我只想禁用相关的孩子,当我取消选中父母时,应该启用所有孩子。

到目前为止尝试过代码......

Config.js

},geoLocationTreeConfig : {
        template: '{{dataItem.text}}',
        checkboxes: {
            checkChildren: false,
            template: '<input  {{dataItem.disabled}} type=\'checkbox\' ng-click=\'updateGeoLoctionList(dataItem)\' value=\'true\' />'
        }

Tree.js

//If the parent item is checked, disable all the children
          if(geoLocation.items){
            $.each(geoLocation.items,function(index,location){
                $scope.disableChild = true;
            });
        }
    }else{
        selectedGeoLocations.splice(pos,1);
        selectedGeoLocationIds.splice($.inArray(geoLocation.id,selectedGeoLocationIds),1);

        //If the parent item is unchecked,  enable the children
        if(geoLocation.items){
            $.each(geoLocation.items,function(index,location){
                $scope.disableChild = false;
            });
        }
    }

0 个答案:

没有答案