Added new node using the below code and not able to find a method to rename the user. Is there any way to rename added new node in the ignite tree ?
$("#firstTree").igTree("addNode", {Text: "New Node"}, selectedNode);
Hello Kavitha,
After investigating this further, I determined that the text of a node could be modified by using the “applyChangesToNode” method. Additionally the added node could be accessed by “findNodesByText”:
var node = $("#tree").igTree("findNodesByText", "New Node")[0].element;
$("#tree").igTree("applyChangesToNode", node, {Text: "New York"});
Below I am attaching a sample, demonstrating the described behavior. Please test it on your side and let me know if you need any further information regarding this matter.
Regards,
Monika Kirkova,
Infragistics
igTreeRenameNode.zip
Thank you I will try to add the method
The updated object could be accessed by using the method “findNodesByText” and passing the new value as argument:
var updatedNode = $("#tree").igTree("findNodesByText", "New York");
The tree could be accessed the following way:
var updatedTree = $("#tree").igTree();
Additionally, by setting new text to a node, the data is not changed, only the text. In order to modify the data, what I could suggest is adding the following line after the “applyChangesToNode” method:
$("#tree").igTree("findNodesByText", "New York")[0].data.Text = "New York";
More information regarding the igTree methods could be found in this topic.
Please let me know if you need any further information regarding this matter.
how to retrieve the parentNode data after dragging the file?
The updated data of the destination tree could be accessed by binding a method to the “nodeDropped” event and getting the ui.data property and the dragged element could be accessed by ui.draggable:
function dropNode(evt, ui) {
var data = ui.data;
var draggedElement = ui.draggable;
console.log(data);
console.log(draggedElement);
}
Below I am attaching the modified sample, demonstrating the described behavior. Please test it on your side and let me know if you need any further information regarding this matter.
1033.igTreeRenameNode.zip
Hi Monika,
Provided drop node it's giving only dropped parent information. I need to retrieve whole tree.. Is there anyway to retrieve from parent element?. I want to retrieve from computer node to child-child node. Is there any method to retrieve whole noe information?.. Node dropped giving just parent-child information.
If I understand right, your requirement is to get the updated data of the destination tree. This could be achieved by getting the id of the destination tree on nodeDropped event and accessing the data of this tree:
console.log(ui);
var id = ui.owner.element[0].id;
console.log(id);
var destinationTreeData = $("#" + id).igTree("option", "dataSource").settings.dataSource;
console.log(destinationTreeData);
Please test it on your side and let me know if you need any further information regarding this matter.
I am glad that you find my suggestion helpful and were able to solve your issue.
Thank you for using Infragistics components.
Thank you for providing the solution. I tested on my side its working as expected.