jsl
Junior Member
Posts: 2
Registered: 5/8/2006
Member Is Offline
|
| posted on 5/8/2006 at 09:08 AM |
|
|
Create tree items dynamically?
Sorry if this has already been answered but I can't seem to find a solution that works for me.
All I want to do is create the tree dynamically from the server side code of a Java Web application rather than use a static .js file. I have tried
creating a text string within servlet code and placing that text into a hidden form field on a JSP. Then I reference that form field value rather
than the global TREE_ITEMS variable. I have checked the form field value to make sure that it is correct but it doesn't seem to work. I don't get
any Javascript error but nothing is generated either.
Here is what I am trying to do:
<script language="JavaScript">
<!--//
var data = document.getElementById("menuData").value;
new tree (data, TREE_TPL);
//-->
</script>
where "menuData" is a hidden form field containing the tree structure.
Is it not possible to use the free menu this way? Do I need to upgrade to get this functionality? Or am I just on the wrong track entirely? Thanks
for your help!
|
|
|
tigra
Administrator
Posts: 1982
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 5/8/2006 at 02:49 PM |
|
|
intead of using the form field print the text of the items structure in the same <script ..> block by your server side script. view the result
using view->source feature of your browser. I.e
<script language="JavaScript">
<!--//
var data = <? ... place your server side code generating items structure here ... ?>
new tree (data, TREE_TPL);
//-->
</script>
|
|
|
jsl
Junior Member
Posts: 2
Registered: 5/8/2006
Member Is Offline
|
| posted on 5/9/2006 at 05:39 AM |
|
|
That worked great! Instead of the form field I wrote a Java custom tag to generate the tree items. (I should have thought of that to begin with).
Thank you very much for the quick response!
|
|
|
tigra
Administrator
Posts: 1982
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 5/19/2006 at 04:35 PM |
|
|
Complete manual for this: http://www.softcomplex.com/forum/viewthread_3551/
|
|
|