我有一个逻辑,当用户选择父我想要禁用子节点时,所以当我选择父复选框时,以下实现所有父母和孩子都禁用。我只想禁用相关的孩子,当我取消选中父母时,应该启用所有孩子。
到目前为止尝试过代码......
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;
});
}
}