Check documentation for the latest version 6.0 of dhtmlxSuite onCheckboxClick DHTMLX Docs

onCheckboxClick

fires when the user clicks any checkbox item

void onCheckboxClick(string|number id,boolean state,string|number zoneId,object cas){ ... };

Parameters

idstring|numberid of the clicked checkbox item
statebooleancurrent checkbox state (true for checked)
zoneIdstring|numbercontext menu zone, if a menu rendered in the context menu mode
casobjectstate of CTRL/ALT/SHIFT keys during the click (pressed/not pressed)

Example

myMenu.attachEvent("onCheckboxClick", function(id, state, zoneId, cas){
    // your code here
    // ...
 
    // cas example
    if (cas.ctrl == true) {
        // open in a new tab
    } else {
        // open on the same page
    }
 
    // allow checkbox to be checked
    return true;
});

Details

The cas object has the following structure (true if a key was pressed during the click):

{
    ctrl:   true/false,
    alt:    true/false,
    shift:  true/false
}

The event is cancellable, to allow checkbox to be checked you need to "return true".

Back to top