PDA

View Full Version : Keep the Visible properties for a tree node after it's parent expanded



cwtuan
29 Jul 2012, 6:43 PM
ExtJS doesn't support setting Visible properties for the tree node.
Here's a workaround http://www.sencha.com/forum/showthread.php?142704-Show-Hide-of-the-tree-node-in-ExtJS-4



setNodeVisible : function(nodeId, visible) {
var node = this.findNode(nodeId);
var view = this.getView();
var el = Ext.fly(view.getNodeByRecord(node));
el.setVisibilityMode(Ext.Element.DISPLAY);
el.setVisible(visible);
}


However, the Visible properties for a tree node would be reset after it's parent expanded.
That is, the invisible nodes would show again after it's parent expanded.
Any idea to keep the Visible properties?
Thanks in advance!

cwtuan
29 Jul 2012, 7:11 PM
After investigating the DOM by using firebug, I found the node expand method doesn't reset CSS, but regenerate its children node.
That's the reason why all children show again.