AlexDemo
AlexDemo

Reputation: 171

disable multiple select in checkbox treeview in react

This is my example with treeviewCheckbox. Now this allow multiple checked. I want to check only one at a time.

sample

If there any suggestions please help me.

enter image description here

Upvotes: 0

Views: 505

Answers (1)

Gabriele Petrioli
Gabriele Petrioli

Reputation: 196217

You can change the setChecked([...checked, ...updatedValues]); to setChecked([...updatedValues]);. But still, if you select a folder it will auto-select all the items beneath it.

If you want to be able to select a single folder, without its its children, then you can remove all your isParent relevant code and add the noCascade property to the tree.

If you read the supported option in the documentation you can find other customization as well.

Upvotes: 1

Related Questions