Rank: Newbie Groups: Member
Joined: 5/27/2008 Posts: 3
|
I am trying to loop through and expand ALL using an example I saw on the forum but it only expands the first level no matter what I set the “Level” to.
function Menu1Click(e, info) { //var group = info.getItem().getParentGroup(); switch (info.getItem().getText()) { case "Expand All": toggleLevel(eo_GetObject('TreeView1').getTopGroup(), 0, true); break; case "Collapse All": toggleLevel(eo_GetObject('TreeView1').getTopGroup(), 0, false); break; } }
function toggleLevel(group, level, show) { for (var i = 0; i < group.getItemCount(); i++) { var item = group.getItemByIndex(i); if (group.getLevel() <= level) item.setExpanded(show); else { var subGroup = item.getSubGroup(); if (subGroup) toggleLevel(subGroup, level, show); } } }
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi, Try to change:
Code: JavaScript
if (group.getLevel() <= level)
item.setExpanded(show);
else
{
var subGroup = item.getSubGroup();
if (subGroup)
toggleLevel(subGroup, level, show);
}
To:
Code: JavaScript
if (group.getLevel() <= level)
item.setExpanded(show);
var subGroup = item.getSubGroup();
if (subGroup)
toggleLevel(subGroup, level, show);
That should get it going. Thanks
|
Rank: Newbie Groups: Member
Joined: 5/27/2008 Posts: 3
|
That did it. Thanks
|