DHTMLX Docs & Samples Explorer

Index
dhtmlxtree
Radio Buttons Manipulation

## Radio Buttons Manipulation

### Enabling/Disabling Radio Buttons

#### Enabling/Disabling Radio Buttons for Tree

dhtmlxTree supports radio buttons. To turn them on for the whole tree, the user should call the following method:

        <script>
            tree.enableRadiobuttons(true); // false - disables radio buttons for the whole tree
        </script>

This method should be called before data loading in the tree takes place.

#### Enabling/Disabling Radio Buttons for Items

There is the possibility to enable radio buttons for child items of a certain node in the tree. In this case, the checkboxes of these child items will be replaced by radio buttons:

        <script>
            tree.enableCheckboxes(true); //enable checkboxes
            tree.enableRadiobuttons(true, itemId);  // enable radio buttons for child items of a certain node; false to disable
        </script>

#### Enabling/Disabling Single Radio Mode

Method enableSingleRadioMode() changes radio buttons logic in the way that there can be only one checked radio button in the whole tree. To switch this mode on, the user should write the following code line:

        <script>
            tree.enableSingleRadioMode(mode, itemId);
        </script>

The parameters are:

- mode(true|false) - whether single radio mode is enabled/disabled;
- itemId - id of the item that will be checked.