View Full Version : Extjs 4.2.1 indent and outdent tree nodes

21 Jul 2014, 6:06 AM
I am using extjs 4.2.1. I want to use indent and outdent in tree grid.
If I select some nodes, I want to make the node above the selected node as parent to all selected nodes.

I have tried by getting selected node and appednchild method (to the node aboove selected)but in that case I have to select nodes sequentially so it didnt worked.

Please reply ASAP if any solution.
Thanks in advance.

29 Jul 2014, 9:56 AM
I'm not 100% sure what you are asking. If you check a node, you want to have it moved to a different node?

29 Jul 2014, 9:50 PM
Hi Mitchell,
consider following link.


In this tree, suppose I want to move "fix light" and "reattach screen doors" to the next level means to make "decorate living room" as parent and the 2 nodes below as children of that. The code I have written for that is:-

var node = Ext.getCmp('gridtores').getSelectionModel().getSelection();
var node1 = Ext.getCmp('tree').store.getByInternalId(node[0].previousSibling.internalId);
for(var i=0;i<node.length;i++){
This code works only if I select sequentially, means if I select "fix light" and "reattach screen doors" sequentially not reverse. If I select reattach screen doors first and then fix light and try to indent the nodes to make the node above the selected node as parent. The above logic fails, as We are using previous sibling property to node[0] that is why it takes the previous sibling of first selected node not the first node in the selection.