angular-tree-component icon indicating copy to clipboard operation
angular-tree-component copied to clipboard

Disable drag feature for individual node?

Open kingbe01 opened this issue 4 years ago • 1 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[X ] Documentation issue or request

What is the current behavior?

I am not sure if this is possible but been looking for a way to disable drag or drop on certain nodes. Like if a user does not have write permissions on certain nodes. If this is possible is there any documentation on how to use it?

Expected behavior:

Minimal reproduction of the problem with instructions:

Version of affected browser(s),operating system(s), npm, node and angular-tree-component:

Other information:

kingbe01 avatar Oct 22 '20 14:10 kingbe01

Hi @kingbe01, it's possible to just enable/disable dragging for specific nodes. If you take a look into the docs for the dragging there is the option to set functions for allowDrag and allowDrop. In those functions you get the node and can test some node properties and enable/disable it based on that.

In our application we get a bool from the api if a node is draggable. If you want to base this on permissions you probably need to add a type property to the nodes and in the function check if the user has permission for that type.

tobiasengelhardt avatar Oct 23 '20 06:10 tobiasengelhardt