DHTMLX Docs & Samples Explorer

Mixed checkboxes

Mixed two state checkboxes

Check item
UnCheck item
Show item's checkbox
Hide item's checkbox
Disable checkbox
Enable checkbox
Check branch
UnCheck branch
Get list of checked

Mixed three state checkboxes

Check item
UnCheck item
Show item's checkbox
Hide item's checkbox
Disable checkbox
Enable checkbox
Get list of checked

Source
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
<script  src="../../codebase/dhtmlxcommon.js"></script>
<script  src="../../codebase/dhtmlxtree.js"></script>
 
 
<table>
    <tr>
        <td valign="top">
            <div id="treeboxbox_tree" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;"></div>
        </td>
        <td style="padding-left:25" valign="top">
        Mixed two state checkboxes<br>
        <br>
        <a href="javascript:void(0);" onclick="tree.setCheck(tree.getSelectedItemId(),true);">Check item</a><br>
        <a href="javascript:void(0);" onclick="tree.setCheck(tree.getSelectedItemId(),false);">UnCheck item</a><br>
        <a href="javascript:void(0);" onclick="tree.showItemCheckbox(tree.getSelectedItemId(),true);">Show item's checkbox</a><br>            
        <a href="javascript:void(0);" onclick="tree.showItemCheckbox(tree.getSelectedItemId(),false);">Hide item's checkbox</a><br>
        <a href="javascript:void(0);" onclick="tree.disableCheckbox(tree.getSelectedItemId(),true);">Disable checkbox</a><br>
        <a href="javascript:void(0);" onclick="tree.disableCheckbox(tree.getSelectedItemId(),false);">Enable checkbox</a><br>                                                
        <a href="javascript:void(0);" onclick="tree.setSubChecked(tree.getSelectedItemId(),true);">Check branch</a><br>
        <a href="javascript:void(0);" onclick="tree.setSubChecked(tree.getSelectedItemId(),false);">UnCheck branch</a><br>
        <a href="javascript:void(0);" onclick="alert(tree.getAllChecked());">Get list of checked</a><br><br>
        </td>
    </tr>
    <tr>
        <td valign="top">
            <div id="treeboxbox_tree2" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;"></div>
        </td>
        <td  style="padding-left:25" valign="top">
                    Mixed three state checkboxes<br>
                    <br>
        <a href="javascript:void(0);" onclick="tree2.setCheck(tree2.getSelectedItemId(),true);">Check item</a><br>
        <a href="javascript:void(0);" onclick="tree2.setCheck(tree2.getSelectedItemId(),false);">UnCheck item</a><br>
        <a href="javascript:void(0);" onclick="tree2.showItemCheckbox(tree2.getSelectedItemId(),true);">Show item's checkbox</a><br>
        <a href="javascript:void(0);" onclick="tree2.showItemCheckbox(tree2.getSelectedItemId(),false);">Hide item's checkbox</a><br>
        <a href="javascript:void(0);" onclick="tree2.disableCheckbox(tree2.getSelectedItemId(),true);">Disable checkbox</a><br>
        <a href="javascript:void(0);" onclick="tree2.disableCheckbox(tree2.getSelectedItemId(),false);">Enable checkbox</a><br>
        <a href="javascript:void(0);" onclick="alert(tree2.getAllChecked());">Get list of checked</a><br>
        </td>
    </tr>
</table>
<br>    
<script>
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
tree.setSkin('dhx_skyblue');
tree.setImagePath("../../codebase/imgs/csh_bluebooks/");
tree.enableCheckBoxes(1);
tree.loadXML("../common/tree_mixed.xml");
tree2 = new dhtmlXTreeObject("treeboxbox_tree2", "100%", "100%", 0);
 
tree2.setSkin('dhx_skyblue');
tree2.setImagePath("../../codebase/imgs/csh_bluebooks/");
tree2.enableCheckBoxes(1);
tree2.enableThreeStateCheckboxes(true);
tree2.loadXML("../common/tree_mixed.xml");
</script>