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
close icon

Remove and Refresh Node

Dear team,
          I want to  remove Tree view Node,but we can't.In your documentation got a Code but it's also not working 

(var instance= document.getElementById("tree").ej2_instances[0];
instance.removeNodes([instance.element.querySelector('.e-list-parent')]))

Please Provide any solution.

Regards,
Abhishek verma


3 Replies

CI Christopher Issac Sunder K Syncfusion Team February 5, 2019 11:54 AM UTC

Hi Abhishek, 
 
Thank you for contacting Syncfusion support. 
 
In our TreeView component, you can use removeNodes method to remove single, multiple or all the tree nodes. For removing single/ multiple nodes you can either pass the tree id or tree node element in the removeNodes method. For removing all the nodes, you can pass the treeview component’s root ul element. We have prepared a sample for your reference. In this sample, we have removed a single node and the entire tree nodes on separate button click. Please check below code block and sample, 
[cshtml] 
var treeObj = document.getElementById('tree').ej2_instances[0]; 
//removes single tree node of id '6' 
treeObj.removeNodes(['6']); 
//removes all tree nodes 
treeObj.removeNodes([treeObj.element.querySelector('.e-list-parent')]); 
 
Please let us know if you have any concerns. 
 
Thanks,
Christo



AV Abhishek Verma February 5, 2019 01:05 PM UTC

Dear team,
     When i am Remove All Node It's Give Error and Time of single Remove node visual it's Deleted But Memory still  Contain Remove Nodes.

Regards,
Abhishek Verma


CI Christopher Issac Sunder K Syncfusion Team February 6, 2019 12:43 PM UTC

Hi Abhishek, 

Thank you for contacting Syncfusion support. 

You have mentioned that on removing all nodes, error is being thrown. It would help us to identify your problem better if you could provide us the below details, 
  • Details of the error
  • Code block used to remove nodes
  • Scenario in which you have used this code

Also, you have mentioned that while removing single node, it is still maintained in memory. Could you please let us know in which memory you can see the removed node getting maintained? 
These details would give us information to find out your issue and help you resolve it. 

Thanks, 
Christo 


Loader.
Live Chat Icon For mobile
Up arrow icon