# Persisting the Expanded Node State

The DropDownTree enables you to define and persist the expanded state of its nodes when the popup TreeView is re-rendered.

## Manual Setup

The DropDownTree exposes the following options to control the expanded state of its nodes:

* [`isNodeExpanded`](https://www.telerik.com/kendo-angular-ui/components/dropdowns/api/dropdowntreecomponent#isnodeexpanded) (`(node: any) => boolean`)—Determines if a given node is expanded.
* [`nodeCollapse`](https://www.telerik.com/kendo-angular-ui/components/dropdowns/api/dropdowntreecomponent#nodecollapse) (`EventEmitter<any>`)—Fired when a given node is about to be collapsed.
* [`nodeExpand`](https://www.telerik.com/kendo-angular-ui/components/dropdowns/api/dropdowntreecomponent#nodeexpand) (`EventEmitter<any>`)—Fired when a given node is about to be expanded.

The following example demonstrates how to manually track and control the expanded node state.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/dropdowns/dropdowntree/expand_state/manual_setup/source.txt)

## Using the Built-In Directive

By default, the built-in [`kendoDropDownTreeExpandable`](https://www.telerik.com/kendo-angular-ui/components/dropdowns/api/dropdowntreesexpanddirective) directive persists the expanded nodes based on their hierarchical index.

The following example demonstrates how the `kendoDropDownTreeExpandable` directive automatically tracks and persists the expanded node state.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/dropdowns/dropdowntree/expand_state/expand_directive/source.txt)

## Suggested Links

* [API Reference of the DropDownTree](https://www.telerik.com/kendo-angular-ui/components/dropdowns/api/dropdowntreecomponent)
* [API Reference of the Expand Directive](https://www.telerik.com/kendo-angular-ui/components/dropdowns/api/dropdowntreesexpanddirective)
