Home - Forums-.NET - FlyTreeView (ASP.NET) - JAVA checkbox, One or no checkbox is checked

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

JAVA checkbox, One or no checkbox is checked
Link Posted: 09-Jul-2007 22:53
Have somebody code to share, JAVA/checkbox  ?

One or no checkbox is checked in tree.

Thanks !!
Link Posted: 09-Jul-2007 23:31
Is the radio button functionality is what you need?

Otherwise, you need to loop (with javascript) though all treeview nodes every time when user checks some node.
Link Posted: 09-Jul-2007 23:48
Yes, Function with one OR none checked checkbox,
function nodeEventHandler(treeview, node, eventType)
Link Posted: 10-Jul-2007 00:02
I think this is what you need. I did not test it though.
var ignoreEvents = false;
function nodeEventHandler(treeview, node, eventType)
{
    if (ignoreEvents) return;
    ignoreEvents = true;
    if (eventType == \"checked\") {
        var checkedNodes = treeview.findAll(function(matchNode){ return matchNode.getChecked(); });
        for(var i = 0; i < checkedNodes.length; i++)
        {
            if (checkedNodes[i] != node)
                checkedNodes[i].setChecked(false);
        }

    }
    ignoreEvents = false;
}
Link Posted: 10-Jul-2007 00:15
Thanks again for your help !