DHTMLX Docs & Samples Explorer

onRadioClick Event

By default this event makes another radio item in the group checked instead of the current checked one. The visible sub-polygon won't be hidden after this action. onRadioClick event can call a user-defined handler (if there is any) and pass the following parameters:

  • group - name of the radio group;
  • idChecked - id of the checked radio item;
  • idClicked - id of the clicked radio item;
  • zoneId (only for Contextual Menu) - id of the contextual menu zone;
  • casState - whether the key “Ctrl”, “Alt”, or “Shift” was pressed with click or not.
        menu.attachEvent("onRadioClick", function(group, idChecked, idClicked, zoneId, casState){
            ...
            // user-defined handler
            // ctrl
            if (casState["ctrl"] == true) {
                    // ctrl key was pressed with click
            } else {
                    // ctrl key was not pressed with click
            }
            // alt
            if (casState["alt"] == true) {
                    // alt key was pressed with click
            } else {
                    // alt key was not pressed with click
            }
            // shift
            if (casState["shift"] == true) {
                    // shift key was pressed with click
            } else {
                    // shift key was not pressed with click
            }
            return true;
        });

When the user attaches a user-defined handler to this event, the state of the item can no longer be changed automatically. The user can control this by returning true|false from a user-defined handler. That's why return true should be added after a user-defined handler in order to let the script know that the state of the item should be changed.