TreeView - collapsing and persistence

Hi support,

I'm using the TreeViewAdv inside my left navigation panel.

If I click on an item, the page is reloaded with the new url and the new item is selected.

So far so good.

The following case does not work so well:

  1. I'm on a page which is on a sublevel of my navigation, the parent node is expanded.
  2. I click on a node on the first level in my navigation
  3. new page is loaded, the correct node is selected
  4. but the former sub level (under the former parent node) is still expanded
Is there a way to collapse this sub level (because I'm not inside that level) ?
Otherwise the user will end up in a fully expanded navigation after a while.

Regards,
Stephan



3 Replies

SA SureshRajan Alagarsamy Syncfusion Team September 2, 2024 05:15 PM UTC

Hi Stephan,


We have reviewed your query and understand you are utilizing the WinForms TreeViewAdv control. To provide you with accurate technical assistance, we kindly request you to confirm the name of the platform you are working on. This information will help us assist you better.


Regards,
Suresh.



SS Stephan Schrade September 2, 2024 05:18 PM UTC

Hi Suresh,

I'm afraid, but I'm using the Javascript Platform.

And the version ist EJ2  26.2.8

Regards,

Stephan



SA SureshRajan Alagarsamy Syncfusion Team September 4, 2024 05:07 PM UTC

Hi Stephan,


Upon further investigation, we would like to inform you that when you add the navigateUrl field to a node, the rendered node element will contain an rel='nofollow' href attribute with the specified navigation URL. As a result, clicking on the node will navigate to the URL, preventing other actions such as node collapse and expand TreeView operations from being performed. However, if you want to maintain the ability to expand and collapse nodes, we recommend using the expand and collapse icons.


Alternatively, we suggest to utilize the nodeClicked, nodeSelecting and nodeSelected events, which are triggered when a node is selected in the TreeView component. By handling page navigation within these event handlers, you can achieve the desired navigation functionality.


Regards,
Suresh.


Loader.
Up arrow icon