Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by shalini on Aug 05, 2009 00:18
open dhtmlx forum
Radibutton in DHTMLXTree

hi,

I have Data till level 4 in my Tree control and I have enabled the radioobutton by using prop:BranchTree.enableRadioButtons(1);, which is enabling radiobutton at all the levels but I want to add these radio buttons just in front of 4th level only and should not be visisble with other levels of the tree.
I have added a function by attaching a event with my tree : BranchTree.attachEvent("onBeforeCheck",setDefault);

function setDefault (sourceID){
var list = BranchTree.getAllChildless();
            var AllLeaf = new Array();
            AllLeaf = list.split(",") ;
var cntDefault = 0;
var bRole = false;
if (BranchTree.getLevel(sourceID) == 4)
{
if (list!="")
             {
for (var i=0;i<AllLeaf.length;i++)
{
if(sourceID == AllLeaf[i] )
BranchTree.setSubChecked(AllLeaf[i],true);
else
BranchTree.setSubChecked(AllLeaf[i],false);
}
             }
            }
            
     }

its solving my purpose, that enebling the radiobutton select at only at 4th level, but we just want to show radiobutton other than 4th level and from all the nodes at 4th levle only one radio button should be allowd to check..
please help

Regards
Shalini
Answer posted by Alex (support) on Aug 05, 2009 02:27

Hello, 

the radiobutton (and checkbox) can be hidden using nocheckbox attribute in the xml:

<item nocheckbox="1"  ... 

or using showItemCheckbox(itemId,mode) method:

tree.showItemCheckbox("some_id",false)