Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Block on Jul 26, 2009 00:54
open dhtmlx forum
dhtmlxGrid before and after context menu events

Hi Gang.

I am using the grid pro edition.

I have a context menu attached (see below).

I am using the onBeforeContextMenu event to set the row of the grid bold before it pops the context menu to re-enforce to the user what they clicked on.

function onContextMenu(rowID, celIndex, grid) {
dhxGrid.setRowTextStyle(rowID, "font-weight:bold;");
//if (celIndex == 1) return false;
return true;
}

I would want to set the text back to unbolded once the context menu disapears whether they clicked on something or not.

What is the most effective way to do this?

I want to do something like this.....

function outContextMenu(rowID, celIndex, grid) {
dhxGrid.setRowTextStyle(rowID, "font-weight:normal;");
//if (celIndex == 1) return false;
return true;
}


Thanks in advance.

---------------------

    //Context Menu
    dhxGridMenu = new dhtmlXMenuObject();
    dhxGridMenu.renderAsContextMenu();
    dhxGridMenu.setOpenMode("web");
    dhxGridMenu.attachEvent("onClick", onButtonClick);
    dhxGridMenu.loadXML("engine/Get_Grid_XML_Menu.asp?CompanyID=<%=CompanyID%>&SID=<%=session.sessionID%>");

//Main Grid
dhxGrid = dhxLayout.cells("b").attachGrid();
dhxGrid.attachEvent("onRowSelect", doOnRowSelected);
dhxGrid.attachEvent("onBeforeContextMenu", onContextMenu);
//dhxGrid.attachEvent("onAfterContextMenu", outContextMenu);
    dhxGrid.setImagePath("./imgs/");
    dhxGrid.setDateFormat("%d %b %Y");

    //Attach the right click menu
    dhxGrid.enableContextMenu(dhxGridMenu);
    
//dhxGrid.enableAutoWidth(true);
    dhxGrid.init();

//Turn off extra context menu
    dhtmlxEvent(dhxGrid.entBox, "contextmenu", function(e) {
     (e || event).cancelBubble = true
     return false;
    });
Answer posted by dhxSupport on Jul 27, 2009 00:55
Unfortunately dhtmlxGrid has no such event. You can use dhtmlxMenu's event to define when item was clicked or showed. Please find more information here http://dhtmlx.com/docs/products/dhtmlxMenu/doc/guide.html#menu_jxhf5