Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
UltraWebListBar with Groups and WebTree showing multiple Items selected - Client Code
posted

I currently have an Ultraweblistbar, with multiple groups, each containing a WebTree within.

 The problem that I am encountering, is that if a user chooses an item in two distinct groups - they both show up highlighted when we only require the last item clicked to be highlighted. To remove the previously selected item, I was going to use the Code below, to traverse through all nodes and turn off any selected items before reselecting the recent click.

 var iglistbarTree = igtree_getTreeById(treeId);

removePrevSelNodes(iglistbarTree.getNodes())

function removePrevSelNodes(nodes) {

for (var i = 0; i < nodes.length; i++) {

if (nodes[i].getSelected() != true) {

 

}

else {

alert(nodes[i].getText())

}

if (nodes[i].hasChildren())

removePrevSelNodes(nodes[i].getChildNodes());

}

}

unfortunately, this only gives me acces to the CURRENT tree clicked, and I cannot reach the other tree's, or groups and turn off their selected nodes.

So I decided to try and get the Groups collection from the Ultraweblistbar. After much research, it appears I had to create a clientside eventhandler for the list bar's initializeListBar event, and create a variable with the Listbar object in it.

var myListBar;

function testInit(oListbar, oEvent) {

myListBar = oListbar;

}

I could then access the Group collection on the client via this statement; myListBar.Groups.

However, I don't seem to be able to retrieve the Child Tree objects from each of the Groups in the Collection - am I missing something here?

I realise that there are a number of other ways I could perform this, I could go back to the server, but am trying to avoid it. I could also have a hidden page variable, that contains the name of the last clicked Node, and each time update it with the latest click, after turning the previous node off. Unless i'm missing something however, this should all be possible, and fairly easy from the Client side object model?

 Thanks in advance, 

 

Parents
No Data
Reply
  • 15
    posted

    Try:

     

    function DeselectMenu(treeId)
        {               
            var group, item;
          
            for (group in igtree_treeState)
            {
                for(item = 0; item < igtree_treeState[group].getNodes().length; item++)
                {
                    if(treeId != group)
                    {
                        igtree_treeState[group].getNodes()[item].setSelected(false);
                    }
                }
            }
        }

Children
No Data