Sometimes you need more than to just be able to navigate a hierarchy of nodes in a tree, say maybe to select one or more nodes. By default, the TreePanel
object allows selection of only a single node at a time; we can configure it to allow multiple node selection by passing SelectionMode.MULTI
to tree.getSelectionModel().SetSelectionMode()
.
Here, we want to use the more flexible and more user-friendly checkbox selection that renders tree nodes with a checkbox, allowing the user to check/uncheck as many nodes as possible at any time, depending on the combination of the values given to tree.setCheckNodes()
and tree.setCheckStyle()
. The following screenshot displays a tree with a checkbox for each node: