tree-multiselect.js icon indicating copy to clipboard operation
tree-multiselect.js copied to clipboard

How to allow 1 maxselection on a certain section?

Open mattmorz opened this issue 4 years ago • 5 comments

I wanted to behave a section as radio buttons? How to I achieve this?

mattmorz avatar Nov 30 '20 03:11 mattmorz

The option right now only supports a global setting, so you can't do this. You can modify the code to fit your purposes though:

https://github.com/patosai/tree-multiselect.js/blob/4db8be77845ce0aa01955af8f87356b03e7c1b72/src/tree-multiselect/tree.js#L401-L415

This will probably need to be implemented a bit differently.

patosai avatar Nov 30 '20 04:11 patosai

Oh ok..is there a way to dynamically uncheck a selection/checkbox? or remove the previously selected>

mattmorz avatar Nov 30 '20 06:11 mattmorz

Not natively, but for now you can get the checkbox element and click it/fire the change event

patosai avatar Dec 01 '20 06:12 patosai

Yes, I managed to solve it using that method. But, it's ugly. :)

mattmorz avatar Dec 01 '20 06:12 mattmorz

Pull requests welcome :)

patosai avatar Dec 01 '20 06:12 patosai