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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programmatically select node by it's id

Thread ID:





143818 Apr 5,2019 09:16 PM UTC Apr 8,2019 10:44 AM UTC Vue 1
Tags: Treeview
Asked On April 5, 2019 09:16 PM UTC


i have the following data structure in my treeview:

{"id":1,"parent_id":0,"name":"Test Folder","subChild":[
{"id":2,"parent_id":1,"name":"Child 1"},
{"id":3,"parent_id":1,"name":"Child 2","subChild":[
{"id":4,"parent_id":3,"name":"Child 3"}
{"id":5,"parent_id":0,"name":"User 2 Folder 1"},
{"id":6,"parent_id":0,"name":"User 2 Folder 2"}]

Is it possible to select a node programmatically through it's id? For example i want to select the node with id 4.
Single node selection mode.

I tried


but without success.

Thanks in adavance

Prince Oliver [Syncfusion]
Replied On April 8, 2019 10:44 AM UTC

Hello Christopher, 

Thanks for contacting us. 

You can programmatically select a node in TreeView by selectedNodes property. Here we provided the selectedNodes property in the dataBound event of TreeView. Kindly refer to the following code snippet. 

    if (args.data.length > 0) 
        this.$refs.treeObj.selectedNodes = ["4"] 

We have attached an example for reference, please find it in the following location 

For further reference, please refer the following API reference: 

Let us know if you need any further assistance. 



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