Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Pong Siew on Jul 05, 2007 06:27
open dhtmlx forum
My dhtmlxGrid have 3 different colunm, I success append the Context Menu into it. But how can I customize each column had its own Context Menu? Futher, can I force the Context Menu to appear when user do single click on the Grid instead of using Right Click event. Thanks!


Answer posted on Jul 05, 2007 10:15
The native support of context menu works only in "one menu per grid" mode, so it not possible to attach few different menus to the same grid ( basically it can be done , by using onRightClick and custom menu handlers, but it is a complex way )

The similar behavior can be achieved with one context menu, which just customized based on active cell|row, it possible to attach custom code to "onBeforeContextMenu" event, and based on active column show|hide some items in menu - so technically here will be one menu object, but it will look different for different columns.

>>can I force ... to appear when user do single click
In case of non MacOs platform it can be done by small code modification

in dhtmlxGrid.js locate next string
    (ev.button==2)
and replace "2" with code of button which necessary in your case
Answer posted on Jul 05, 2007 13:01
in dhtmlxGrid.js locate next string
    (ev.button==2)
and replace "2" with code of button which necessary in your case
After do some testing, I found that the 'Left Button' Click event was '1', 'Right Button' click event was '2' and 'Scoll Button' Click event was '4', right?

I had try to change the syntax from   (ev.button==2) to (ev.button==1) or (ev.button==4), the program will enter the 'if (this._ctmndx){' block code, but the Context Menu was not show/pop up for (ev.button==1) or (ev.button==4) when I click 'Left Button' or 'Scoll Button'. When I change the back (ev.button==2), the ContextMenu will show/pop up when I click 'Right Button'.
    Futher, should I put 'grid.enableEditEvents(true,false,false);' or 'grid.enableLightMouseNavigation(true);' to handle single click event? I had try to put either this two line code but it still not working. Any suggestion?

    I had another Question, in the dhtmlxGrid, can I disable/set read only to each row? eg. When the Grid finish loaded, I will have 5 empty row with 3 column, I need to enable first row and disable the bottom 4 row. When I finish fill the text for 1st row, then 2nd row will be enable but 3rd, 4th and 5th row still disable. When I finish fill 2nd row, 3rd row will be enable...etc. I try to use mygrid.enableEditEvents(false,false,false);, but all row will disbled. Please help!
    Thanks!





Answer posted by radyno (Support) on Nov 27, 2014 17:25

To find more precise comments upon this issue, we can offer you read about javascript checkbox tree and touch ui design.