Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
673 views
in Technique[技术] by (71.8m points)

reactjs - 如何以编程方式在Material Ui中展开或折叠Tree Item?(How to programmatically expand or collapse Tree Item in Material Ui?)

Is there any way to programmatically expand and collapse tree items in material ui?

(有什么方法可以以编程方式扩展和折叠材料ui中的树项目?)

I can do that by clicking on the item, but there are other times when I would like to collapse and expand the tree items based on an action in the tree view.

(我可以通过单击项目来做到这一点,但是有时我想根据树视图中的操作折叠和展开树项目。)

is it possible?

(可能吗?)

  ask by Akira Kotsugai translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There are 1 callback function you can use

(您可以使用1个回调函数)

onNodeToggle :Callback fired when a TreeItem is expanded/collapsed.

(onNodeToggle:展开/折叠TreeItem时触发的回调。)

Signature: function(nodeId: string, expanded: boolean) => void nodeId: The id of the toggled node.

(签名:function(nodeId:字符串,扩展:布尔值)=> void nodeId:切换节点的ID。)

expanded: The node status - If true the node was expanded.

(扩展:节点状态-如果为true,则扩展节点。)

If false the node was collapsed.

(如果为false,则节点已折叠。)

Document link

(文件连结)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...