Board Logo

Need a function to "select" a node
valinotea - 9/7/2006 at 09:09 AM

What I am trying to do is call a small function, onLoad, that would "select" a particular node in my tree. Each page in our (non-profit) website would need this small script -- only the node specified would be different from page to page. This would greatly simplify maintainence. BUT, I need help writing the function.

This is an attempt to mimic some persistance so the user has the visual cue as to which page they're on when they get there.

For instance, if the user navigates to "Contact Us", when contact.html loads, this little piece of JavaScript in the HTML would select that node (bolding it and displaying the appropriate icon).

-Contact Us

Thanks in advance

tigra - 9/7/2006 at 10:48 AM

here is the post with the sample of the function that searches for the items by name then opens and highlights it:

valinotea - 9/7/2006 at 12:16 PM

Thanks for the reply.

But, no matter how I try calling the function you linked to, I get the following error:
'a_index.a_config.0' is null or not an object

I thought for example <BODY onLoad="setTree('Portfolio')> would work ("Portfolio" being one of the captions in my tree)

tigra - 9/8/2006 at 12:02 AM

submit a support ticket attaching the demo of the problem in the zip package. we'll take a look and let you know where is the problem.

valinotea - 9/8/2006 at 08:33 AM

I'm considering getting the Pro version, which likely will solve my issues.


Sjodan - 3/22/2007 at 03:36 PM

The reason you get the 'a_index.a_config.0' message when you try to use the setTree function as it is written in the thread linked above is that this forum appears to remove the combination of [ + i + ] (imagine that the spaces and + are not there) in the text that is written.

The code as it is displayed on the forum is changed when it is posted and therefore turn out all wrong.

For instance the line "o_tree.a_index.a_config[0]" should read "o_tree.a_index[ + i + ]a_config[0]"
(again, imagine the spaces and + are not there).

Just look over the code and make sure that the iterations acctually iterate.

Back to forum: