Board Logo

Expand/Collapse All Functions
senojeel - 5/24/2005 at 10:23 PM

I am trying to use the API example of the Expand/Collapse functions. I placed the functions code into the tree.js file and I placed the call samples in the html after my <script>new tree....</script> When I try to expand or collapse, I get "Tree is not initialized yet." I am pasting the code without any changes. Do I need to change something so it will see my tree?

BTW, I am using the latest Pro version.

Thanks for your help!

Shawm


rock - 5/25/2005 at 10:23 AM

First of all there is no need to modify original tree.js file (it's not allowed by license agreement), you could link the extra code by including it to other files (tree_items.js, tree_tpl.js, etc.)
how does your tree constructor looks like (new tree....) ?
please provide full line.


senojeel - 5/25/2005 at 05:38 PM

For the time being, I have moved the functions into the items file.

Here is the code I think you were referring to.


<script language="JavaScript">
<!--//
new tree (TREE_ITEMS, TREE_TPL, 'FITS_Tree');
//-->
</script>

After that is where I have the links for expand/collapse.

<a href="javascript:expand_all(0,1)">Expand All</a> |
<a href="javascript:collapse_all(0,1)">Collapse All</a>


rock - 5/26/2005 at 03:08 PM

As your tree is named ('FITS_Tree') the correct usage is:

<a href="javascript:expand_all('FITS_Tree',1)">Expand All</a> |
<a href="javascript:collapse_all('FITS_Tree',1)">Collapse All</a>


senojeel - 5/26/2005 at 04:10 PM

Thanks Rock, you're awesome!


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/