We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Expanding tree path to selected node

Thread ID:

Created:

Updated:

Platform:

Replies:

146025 Jul 17,2019 10:25 AM UTC Jul 18,2019 12:32 PM UTC Vue 1
loading
Tags: Treeview
Konrad Lowczak
Asked On July 17, 2019 10:25 AM UTC

Hi

I want to expand tree from root to selected node. According to documentation ensureVisible function should handle this but it does not work.
Also expandAll with parameters is not working. I can expand all nodes in tree using expandAll without params, but according to documentation I can pass array of nodes.
Still does not work.

In my code I use code like below:
this.$refs.treeView.ensureVisible(nodeId);
Can You solve my problem?

Christopher Issac Sunder K [Syncfusion]
Replied On July 18, 2019 12:32 PM UTC

Hi Konrad, 

Greetings from Syncfusion support. 

We have checked with your requirement. The problem might occurs due to any of the below, 

  1. In the expandAll and ensureVisible, you might have passed the node ids other than string arrays (Ex. Integer) but we have to pass it as string arrays.
  2. We can’t expand a tree node (may be child) when the node elements is not created in DOM. By default, the child node elements will be created on demand while expanding the parent node.

We have prepared a sample for your requirement. Here is the code for your reference, 

onClick: function (args) { 
    //expand the nodes 16 - MP3 Albums, 21 - More in Music 
    this.$refs.tree1.expandAll(['16', '21']); 
    //Scroll the node into view - Jazz 
    this.$refs.tree1.ensureVisible('20'); 
} 

Please refer the below sample, 

Please get back to us if you are facing the issue still. 

Thanks,
Christo 



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon