# Control of Expand Node

###### [ File Path: core/expand.html ]

- ## 1, 'beforeCollapse / onCollapse'
  'beforeExpand / onExpand' callback function

  - Use 'beforeCollapse / onCollapse' and 'beforeExpand / onExpand' callback function can control whether to allow expand or collapse the parent node . This simple demo shows how to monitor the collapse and expand event.

  - Try:
    Whether trigger the callback when execution expandNode() method.
    Single Node --[ expand ] [ collapse ] [ toggle ]
    Single Node (including child) --[ expand ] [ collapse ]
    All Nodes --[ expand All ] [ collapse All ]

  - How to use zTreeObj.updateNode method, please see the API documentation.
    collapse / expand log:

- ## 2, Explanation of setting

  - Set attributes about 'setting.callback.beforeCollapse / onCollapse / beforeExpand / onExpand', please see the API documentation for more related contents.
  - If you need to adjust the expand / collapse animation effects, please see the API documentation about setting.view.expandSpeed.

- ## 3, Explanation of treeNode

  - No special requirements on the node data, the user can add custom attributes.