excell type menu

Hi I had made a excell type menu:



function eXcell_menu(cell){ //excell name is defined here

if (cell){ //default pattern, just copy it

this.cell = cell;

this.grid = this.cell.parentNode.grid;

}

this.edit = function(){

     //_rowID = cell.parentNode.idd;

//_colID = cell._cellIndex;

var arPos = this.grid.getPosition(this.cell);

        var menu = new dhtmlXMenuObject("",“standard”);

        menu.setImagePath("<CCS_DOCUMENTS_DIR_URL>/dhtmlxMenu/codebase/imgs/");

        menu.renderAsContextMenu();

        menu.attachEvent(“onClick”,function(menuitemId,type){

            mygrid.cells(mygrid.getSelectedRowId(),mygrid.getSelectedCellIndex()).setValue(menuitemId);

            mygrid.editStop();

         });

        menu.setOpenMode(“web”);

        menu.loadXMLString(’’);

        menu.showContextMenu(arPos[0], arPos[1]);

        //alert(menu)

    } //read-only cell doesn’t have edit method

//this.isDisabled = function(){ return true; } // the cell is read-only, that’s why it is always in the disabled state

this.setValue=function(val){

//var row_id=this.cell.parentNode.idd; //get related row id

this.setCValue(valuesof[val][‘name’],val);

         this.cell.combo_value = val;

         //this.setCValue(val+"",val);

}

    this.getValue=function(){ return this.cell.combo_value; }

    this.detach = function(){

     this.grid.setActive(1);

        return true;

    };

}

eXcell_menu.prototype = new eXcell; // nest all other methods from base class



I like when the user click outside of context menu it disappear, in whoch event I can make that?



Thanks a lot

By default grid stops edit process on any click outside of grid area. So you just need to handle detach method of your custom excell.
this.detach = function(){

    this.grid.setActive(1);

    // code to close content menu can be added here
    return true;

};