- Create Account

Expand the Parent Node in CheckTree with minus sign

Forums > Other DHTML / JavaScript > Expand the Parent Node in CheckTree with minus sign
Author
Message

1) Raji Group: Guests
IP: 192.18.--.--
I want to expand the parent node if one of its child is selected.

Sample code :

<ul  id="tree-checkmenu" class="checktree">
<li id="show-netscape">
<b>First Group</b>
<span id="count-netscape" class="count"></span>
<ul id="tree-netscape">
<li ><input type="checkbox" name="box1" value="value1"<%if(request.getParameter("box1")==value1) out.print("checked");%>><b>product1</b></li>
<li ><input  type="checkbox" name="box2" value="value2" <%if(request.getParameter("box2")==value2) out.print("checked");%>><b>product2</b></li>
</ul>
</li>
</ul>

If the user enters the page with the url:
http://myserver.com/index.jsp?box1=value1

Then  I see that "box1" is checked.And next to First Group we see as "1 checked".
But at the same time I want the parent node (First Group) to be expanded with minus sign, just like how it happens when we do onclick for the "+" sign, so that I can see the product1 checked clearly.

Any idea would be appreciated.

Thanks,
Raji.

2) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 155.205.--.--
Perhaps set the appropriate CLASS attributes when you generate the page on the <ul> nodes? You can check the CSS file to see the required ones -- if you set them, the tree will appear expanded and with minus symbols instead of plus symbols.

Good luck - Angus.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.