Board Logo

tree opens in a particular state
doonee - 3/6/2005 at 07:54 AM

hi all

hope someone can help me out

Id like to know, and im sure it has been asked before,
how can configure the tree to open in a particular state.
For example:

--already expanded1
--already expanded2
--already expanded3

(it would be ok for me, in this case here, for this particular state to be default, that is, to always appear like that)

is there any simple way to do that in the free version ?

thanks in advance +best regards


Dor - 5/23/2005 at 08:24 PM

I needed the same functionality, so I've made a hack to TTM that makes it possible.
Take a look at attachment.

Modification is based on this ( code & can be improved :) but 4 my purposes it's enough.
usage is slightly modified too - when calling a tree method use next syntaxys:
new tree (TREE_ITEMS, TREE_TPL, unfold_first, unfold_last);
where 2 first parameters are well known :) unfold_first and unfold_last means positions in array between which nodes should be unfolded.

in fact, much better solution would be giving a tree an array with positions in array of nodes wich should be unfolded, but I'm a little lazy :) And I do not really need this :)

Dor - 5/24/2005 at 12:44 PM

I've found that my modification does not complitly fits my demands so I made one more hack. This time I'm using array of nodes positions that should be unfolded.
where UNFOLD_ITEMS is smthg like that:
UNFOLD_ITEMS = [ 0,10,21,25 ];
this number are node positions in array TREE_ITEMS.
NB! all nodes should open from parent to descendant. otherwise only parent will be unfolded.

I'm not JS guru, so my script have a weak point: function tree MUST get an array UNFOLD_ITEMS or you'll get error: "length is null or not an object". In IE script still workin, but error is always error :)
can somebody add a right check so it would be possible call
new tree (TREE_ITEMS, TREE_TPL); - no unfolding
sorry, but I cannot :(

JamieT - 8/9/2005 at 09:36 AM

Hi Dor,

Hope you are still around. I too need to open the tree menu with particular nodes open and whilst I understand the principle of ywhat you are doing with your code, I need a little help with a couple of things :)

If you respond to this post, I will provide more detail of where I'm having a problem :)



JamieT - 8/9/2005 at 10:26 AM

Worked it out... :)


Back to forum: