Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: tree menu pro states
asterix
Member

Posts: 13
Registered: 9/23/2004
Location: South Italy
Member Is Offline
posted on 5/22/2005 at 06:22 PM Reply With Quote
tree menu pro states


Sorry for my english, I am Italian.
I do not know well javascript.
Is there anybody that can say to me exactly what I have step by syep to do to use the reset_state not to have persistant treeview on reloaded page? It is almost an emergency!!!

Thank you in advance,
Tiziano
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 5/23/2005 at 04:45 PM Reply With Quote

Edit your tree_tpl.js:
Code:

var tree_tpl = {
...
'beforeInit':'killTreeStates',
'afterInit':'opentoDepth'
// make sure there is no comma after the last key-value pair
};

function killTreeStates(o_tree){
o_tree.o_root.reset_state(); //reset open/close/selected states of the tree
return true;
}

function opentoDepth(o_item){
if(o_item.a_children && o_item.n_depth<0)
//n_depth<0 - open roots; n_depth<1 - open roots and first level nodes, etc.
for(var i=0; i<o_item.a_children.length; i++){
o_item.a_children[ i].open() // open item
opentoDepth(o_item.a_children[ i]) //recursive call
}
}
View User's Profile View All Posts By User U2U Member
asterix
Member

Posts: 13
Registered: 9/23/2004
Location: South Italy
Member Is Offline
posted on 5/24/2005 at 12:07 AM Reply With Quote
still problem


I appreciate your answer, but there are still problems:
1) I had to eliminate the 'opentoDepth' function becouse it produced a javascript error of 'methos or property non found on the object...' (or something like that)

2) the real big problem is this: I create dinamically a tree menu depending on a choise of the user. I create correctly the tree_items.js but when the user try to switch to another tree dinamically (clicking on a link) it works fine in memory but I must refresh manually the left frame where the treemenu works if I want to see the correct treeview menu.

I hope that you give to me a solution for both points. It is very important for me.

I thank you anyway,
Tiziano
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 5/24/2005 at 09:14 AM Reply With Quote

1. Please copy&paste opentoDepth function again - due to BBCode reserved tag in previous post some code was missed.
2. You could use several names for your trees so different states will be saved for them. To set tree name use third argument in tree constructor call:
Code:

<script language="JavaScript">
<!-- //
new tree (TREE_ITEMS, TREE_TPL,'MyTree');
// -->
</script>
View User's Profile View All Posts By User U2U Member
asterix
Member

Posts: 13
Registered: 9/23/2004
Location: South Italy
Member Is Offline
posted on 5/24/2005 at 02:54 PM Reply With Quote
help again...


About your 1) point:
1. Please copy&paste opentoDepth function again - due to BBCode reserved tag in previous post some code was missed.

what do I have to do exactly? copy&paste the previous code or what?

Thank you very much again,
Tiziano
View User's Profile View All Posts By User U2U Member
asterix
Member

Posts: 13
Registered: 9/23/2004
Location: South Italy
Member Is Offline
posted on 5/24/2005 at 02:57 PM Reply With Quote
help again2...


...new tree (TREE_ITEMS, TREE_TPL,'MyTree');

where can I find the 'MyTree' treeview name? Is it the file name? or is it a variable name? I did not touch anything from your original code (except for the items...)

thank again,
Tiziano
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 5/24/2005 at 04:08 PM Reply With Quote

'MyTree' is value of the tree name and you don't need to seek it or smth
Each named tree will have separate open/closed states. As I said third argument is tree instance name, and you could use any numeric or string value for it ('MyTree', '1232423', 332123, 'myTree1111', etc.). If you created tree with name 'mytree1', and then reload the page but create tree with different name (say 'mytree2') - the states (open/selected) will not be shared, i.e. second time tree will be opened with default view. If you then again reload the page with 'mytree1' named tree - states preserved for the name will be restored.
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 5/24/2005 at 04:14 PM Reply With Quote

Anyway if you need assistance our specialists are ready to customize/setup the control for your needs for low hourly rates. Please refer to our Customer Care System
View User's Profile View All Posts By User U2U Member
asterix
Member

Posts: 13
Registered: 9/23/2004
Location: South Italy
Member Is Offline
posted on 5/24/2005 at 04:23 PM Reply With Quote
working better...


fixed then opentoDepth function, now the nodes work ok when the afterinit event in called.
But the big problem still remain:
I have 3 frames, header, menu (on the left side) and work (on the rigth side). I show several links on the work area and when a user click on one of them I create dinamically the treeview. It works fine in memory and it really create the items.js file. the problem is that when somebody click on the link the menu frame on the left side doesnt refresh itself. If I refresh manually I can see the new created treeview.
I hope to be clear.

Thank you in advance again,
Tiziano
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 5/25/2005 at 10:31 AM Reply With Quote

So the problem is in menu frame not in tree control? What code should fire menu frame refreshing?
View User's Profile View All Posts By User U2U Member
asterix
Member

Posts: 13
Registered: 9/23/2004
Location: South Italy
Member Is Offline
posted on 6/3/2005 at 04:47 PM Reply With Quote

Layout with 3 frames, 1 row on top, 2 cols.
I show on the right frame the names of saome directories and when the user click on one of them I create dinamically with php the tree_items.js using the name of the user in this way
<code>
<script type='text/javascript' src='js/<?php print $_SESSION['username'].".js'"; ?>></script>
</code>
It works fine. I find a different file depending of the choise of the user. I create a new user.js every time the user click on one link of the right frame.
The problem is this: when the user click on the right frame over another link representing the name of a directory the new user_tree.js file is really created, I reload the main page with the 3 frames, but the left frame doesn't refresh itself with the new treeview. If I want see the new treeview I must right click over the left frame with the mouse and choise refresh.
The left frame is this:
<code>
<?php
include("init.php");
include("lib/utility.php");
?>

<html>
<head>

<script type='text/javascript' src='js/<?php print $_SESSION['username'].".js'"; ?>></script>
<script type='text/javascript' src='js/tree_tpl.js'></script>
<script type='text/javascript' src='js/tree.js'></script>
</head>

<body bgcolor="#efebde">
<script language="JavaScript">
<!-- //
new tree (TREE_ITEMS, TREE_TPL, 'MyTree');

// -->
</script>
</body>
</html>

</code>

I think that I could do something when the 'afterinit' event is called, but it already call the opentoDepth function that you gave to me.

Sorry for my English, I hope to be clear and I thank you a lot for your answer,
Tiziano
View User's Profile View All Posts By User U2U Member
asterix
Member

Posts: 13
Registered: 9/23/2004
Location: South Italy
Member Is Offline
posted on 6/3/2005 at 04:49 PM Reply With Quote
BBCode


Sorry, I did not use well the BBCode system...
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 6/6/2005 at 10:01 AM Reply With Quote

I think you should check the point where you refresh the main frame, make sure your menu frame is refreshed with recreated user_tree.js. Don't think the control could cause such refresh problems.
View User's Profile View All Posts By User U2U Member
asterix
Member

Posts: 13
Registered: 9/23/2004
Location: South Italy
Member Is Offline
posted on 6/6/2005 at 02:35 PM Reply With Quote
OK


You were rigth...
The problem was a wrong refresh of the menu frame.

Thank you much for all
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Multiple Trees
Frames Targeting
Icons and Styles Overloading
Event Handling
Performance Test
Version 1.2 features
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004