Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mike on Nov 07, 2009 22:20
open dhtmlx forum
tree initialization from HTML(Default open nodes)

<body onload="initTree()">

<div id="treeboxbox_tree" setimagepath="../../includes/components/codebase/imgs/csh_vista/">
<ul>
<li open="1" id="id1">TITLE 1
<ul>
<li>OPTION 1</li>
</ul>

</ul>
</div>

function initTree(){

var myTree = dhtmlXTreeFromHTML('listBox');

myTree.openItem('id1');

}

previous Code can open nodes default.
but <ul><li> date is saved in request scope (ex: ${date} ),JSP can't display any date
code is as follows:
    <div
class="dhtmlxTree"
id="news_tree"
setImagePath="/TestTree2/img/treeSkin/csh_books/"
    >
        <ul>
            <li open="1" id="rootId">Root
                <ul>
                    <s:iterator value="#application.newsMenu" id="menu" status="status">
                        <li>${menu.menuName }
                            <ul>
                                <s:iterator value="subMenus" id="subMenu">
                                    <li>${subMenu.subMenuName }</li>
                                </s:iterator>
                            </ul>
                        </li>
                    </s:iterator>
                </ul>
        </ul>
</div>

<script type="text/javascript">
    function initTree()
    {
        //var myTree = dhtmlXTreeFromHTML('news_tree');
        
        //myTree.openItem('rootId');
        
    
    }
</script>

if I remove javascript,this JSP can show node,but close default,
if it possible open default and date is dynamic?




Answer posted by Alex (support) on Nov 09, 2009 05:40

Hello, 

open="1" attribute is supported only with initialization from <xmp> tag.

<div id="treebox" class="dhtmlxTree" ....>
 <xmp container="true">
 <item text="Root" open="1" id="11">
  ....
 </item>
 </xmp>
</div>

If you  use initialization from list, it is necessary to use openItem method.