doonee
Member
Posts: 10
Registered: 3/6/2005
Member Is Offline
|
| posted on 3/6/2005 at 07:54 AM |
|
|
tree opens in a particular state
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:
HOME
+subject1
+subject2
--already expanded1
--already expanded2
--already expanded3
+subject3
+subject4
(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
doonee
|
|
|
Dor
Junior Member
Posts: 4
Registered: 5/23/2005
Member Is Offline
|
| posted on 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 (http://www.softcomplex.com/forum/viewthread_290/) 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 :)
Attachment: modified_TTM.txt (5.92kb)
This file has been downloaded 520 times
|
|
|
Dor
Junior Member
Posts: 4
Registered: 5/23/2005
Member Is Offline
|
| posted on 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.
usage:
new tree (TREE_ITEMS, TREE_TPL, UNFOLD_ITEMS);
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
OR
new tree (TREE_ITEMS, TREE_TPL, UNFOLD_ITEMS);
???????
sorry, but I cannot :(
Attachment: modified_TTM.txt (5.93kb)
This file has been downloaded 489 times
|
|
|
JamieT
Junior Member
Posts: 3
Registered: 8/9/2005
Member Is Offline
|
| posted on 8/9/2005 at 09:36 AM |
|
|
A little help Dor?
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 :)
Thanks
Jamie
|
|
|
JamieT
Junior Member
Posts: 3
Registered: 8/9/2005
Member Is Offline
|
| posted on 8/9/2005 at 10:26 AM |
|
|
Sorted
Worked it out... :)
Cheers
|
|
|