Skip to content Skip to sidebar Skip to footer

Ivh Tree - Disable Node For Selection

I am new to ivh tree (https://github.com/iVantage/angular-ivh-treeview) and using this library. I want to disable to certain nodes for selection, based on user entitlement for exam

Solution 1:

To accomplish this you'll need to put some logic into a custom node template. Here's a stripped down example where I've introduced a helper directive that just inspects the node scope value and disables its checkbox if needed.

http://jsbin.com/buqaxu/2/edit?html,js,output

app.directive('isCbEnabled', function() {
  return {
    link: function(scope, element, attrs) {
      if(scope.node.disabled) {
        element.find('input').attr('disabled', true);
      }
    }
  };
});

You'd could attach something like this to your the ivh-treeview-checkbox directive in your template. Note that node is a supported scope variable within templates.

Post a Comment for "Ivh Tree - Disable Node For Selection"