meetppr
Junior Member
Posts: 2
Registered: 12/6/2006
Location: Bangalore
Member Is Offline
|
| posted on 1/9/2007 at 05:40 AM |
|
|
Retain the state of the tree
How can i retain the state of the tree after reloading the page.
I am generating the tree dynamically from the database.
My tree consists of five levels. Once a new element has been added, i should refresh the page for the new element to get into the tree.
But once refreshed entire tree gets collapsed where as i want that corresponding new element path to be expanded in the tree.
Can anybody help me please?
Thanks
|
|
|
tigra
Administrator
Posts: 1982
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 1/9/2007 at 05:18 PM |
|
|
PRO version of the script uses cookies to save/restore the state between reloads, but this will not work with dynamic data because indexing of the
items shifts every time you add/remove items so data saved for one item will be applied to another. You'll need to implement some method tied to
unique server side IDs of the tree items either saving the state information in cookies on the client side or in the database.
|
|
|
meetppr
Junior Member
Posts: 2
Registered: 12/6/2006
Location: Bangalore
Member Is Offline
|
| posted on 1/9/2007 at 09:30 PM |
|
|
@Tigra
I had unique id's for each of the tree items which are saved in the database.
Now can you tell me how can i open a particular path in the tree using these ID's.
I think i need a javascript function to open a particular path in the tree. But i cannot make it out how to write that function.
Can u help me?
| Quote: | Originally posted by tigra
PRO version of the script uses cookies to save/restore the state between reloads, but this will not work with dynamic data because indexing of the
items shifts every time you add/remove items so data saved for one item will be applied to another. You'll need to implement some method tied to
unique server side IDs of the tree items either saving the state information in cookies on the client side or in the database. |
|
|
|
tigra
Administrator
Posts: 1982
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 1/9/2007 at 09:42 PM |
|
|
You can pass ID's to the items in the item scope settings:
['Home', 'http://www.softcomplex.com/',{'myID': 35, 'tt':'some tooltip text'}]
Then you can loop through the list of tree items (o_treeRef.a_index property) looking for that ID which can be accessed like this
var myID = o_itemRef.a_config[2]['myID'];
Once found you need to open all its parents starting from the one closest to the root.
It's not really a rocket science, but if you're not comfortable with javascript submit a support ticket and we'll give a quote for the custom
coding.
|
|
|