Closed lijingdoc closed 1 year ago
@dingyi222666 Could you help me?
I don’t have time to develop TreeView recently. I may have to wait a few weeks before I can continue developing.
Ok. This is a simple question. First, let's expand the root node list when initializing the tree.
treeview.expandUntil(1,true)
// or expandAll
treeview.expandAll(true)
Then you need to implement the TreeViewBinder
and override the onToggle
method.
The onToggle
method run after the default action (like expanding or collapsing a node), so you just need to check if the node is the root node in this method, and then set it to force expand.
override fun onToggle(
node: TreeNode<DataSource<String>>,
isExpand: Boolean,
holder: TreeView.ViewHolder
) {
if (node.depth < 1) {
node.expand = true
}
}
Hi, @dingyi222666 It works well, thanks so much.
Thanks for your great library.
I need your help. I want to disable to collapse of the root node. It means that the root node should be expanded forever. Is there any way?
Thanks