View Full Version : Need help please with bookmarking async tree

29 Jul 2009, 3:14 AM
Hi all,

Being a newbie, I am having trouble trying to understand and implement the range of approaches I have found on this forum, which are for varied requirements and different versions of ext js. many assume one knows where exactly and insert and call from etc, which I do not... yet.

I am using ext js 3.0.
I have a simple file browser - async treepanel on the left and detail panel on the right.
I have used the 'layout-browser' from the official Ext Js 3.0 examples as a base.

All I want to do is get the initial node or path from a querystring (a bookmark), which automatically expands the tree to that node (regardless of depth), when index.html is opened.

I have attached my complete project to this post (see attachment on first reply below). Please can someone use my example and tell me the official approach to initialize an async tree panel with an expanded node, which in this case is a file manager. I have used the relative path as the id value here, but not sure if that is correct or would help.

To use my example,
1. unzip into a NEW folder on your local apache server. (it uses php to get json and iframe src for detail)
2. simply change the '../ext3' references in index.html to point to your installation of ext js 3.0

I have attempted a few expand options and even tree state but I cannot get it to work, I really need someone to show me fully using my example.

thanks to anyone who has the time to help.

29 Jul 2009, 3:23 AM
cannot see my attached zip, so attempting to attach again.

4 Aug 2009, 3:03 AM
@coderb -- Generally, evaluating node attributes can be done as each node is loaded into the Node heirarchy. Try the treePanels 'append' event to decide whether the node is worthy of expansion:

treePanel.on('append', function(tree,parentNode,node,index){
var NA = node.attributes;
if( NA['someAttrib'] = startdir ){
tree.expandPath (node.getPath() ); //selectPath might be approp too?

and consider using the 'select' event instead of 'click'. That way programatic selection of a node will update your detail Panels too.

4 Aug 2009, 7:27 AM
Yah I agree with Hendricd, you need to give each node a unique value (I would just use the id), the file path should be fine... Then use expandPath to open that node.

5 Aug 2009, 2:41 AM
thanks a lot for the help Doug, I think that will do the trick, I am just tinkering with it because I need to make it a loop in order to do a recursive node expand

thanks Clint too