Welcome Guest Search | Active Topics | Sign In | Register

Hiding TreeView Nodes Options
Craig
Posted: Sunday, December 7, 2008 9:53:23 PM
Rank: Member
Groups: Member

Joined: 3/4/2008
Posts: 14
Hi ..

I am using the treeview with a context menu which has a 'Delete' option.

I use the following code:

var Node;//global node

function ShowContextMenu(e, treeView, node)
{
Node = node;
var menu = eo_GetObject("<%=Menu1.ClientID%>");

menu.getTopGroup().getItemByIndex(0).setText("Delete '" + node.getText() + "'");
eo_ShowContextMenu(e, "<%=Menu1.ClientID%>");
return true;
}

function ItemClick(e,info)
{
Node.setCheckState(0);
Node.setVisible(false);

Need to do the same to the node's child nodes here !!


}

I want the treeview to set check state and visibility of all child nodes under the one I've 'deleted' .. how can I do this? At the moment only the root node is affected ?
eo_support
Posted: Monday, December 8, 2008 8:04:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You do not need to call setVisible on child nodes since visually when the parent node is invisible, all child nodes are invisible. If you wish to clear check state for all child nodes, you can do it recursively, it will be something like this:

Code: JavaScript
function ClearCheckState(node)
{
   //Clear check state for this node
   node.setCheckState(0);

   //Clear check state for all child nodes
   var subGroup = node.getSubGroup();
   if (subGroup)
   {
       for (var i = 0; i < subGroup.getItemCount(); i++)
       {
           var childNode = subGroup.getItemByIndex(i);   
           ClearCheckState(childNode);
       }
   }
}


Hope this helps.

Thanks!
Craig
Posted: Monday, December 8, 2008 2:52:24 PM
Rank: Member
Groups: Member

Joined: 3/4/2008
Posts: 14
Hi..thanks for that... my tree certainly wasn't hiding child nodes.... but the code you provided with some modifications has enabled me to work around it ...thanks.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.