Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Carsten Haerle on Jul 02, 2009 03:36
open dhtmlx forum
Sharepoint style left click context menuin dthmlxgrid

Is it possible to have left mouse button context menu in dthmlxgrid like in Microsoft sharepoint?

See

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/DropDown/DropDown.aspx

for an example.
Answer posted by Alex (support) on Jul 02, 2009 05:12

Grid doesn't provide a ready solution. But there is onMouseOver that allows to get target html element. So, you can get its position and show the necessary container in it:

grid.attachEvent("onMouseOver", function(rowId,cellIndex){

var td_elem =  grid.cells(rowId,cellIndex).cell;

/*your code here*/

})

Answer posted by dhxSupport on Jul 02, 2009 05:21
There are several ways to implement such context menu

1. You can use "coro" eXcell type and use mode when cell editor opens by single click:
mygrid.enableEditEvents(true,true,true); 
Please find example here http://dhtmlx.com/docs/products/dhtmlxGrid/samples/events/pro_edit_events.html
In such case one click edit mode will be applied for the whole grid.
2. You can attach "onRowSelect" event to the grid and open "coro" editor by single click:
mygrid.attachEvent("onRowSelect",function(rowId,cellIndex){
  if (cellIndex==CORO_COLUMN_INDEX) mygrid.editCell();
 });
3. You can implement custom eXcell type and show necessary contex menu by single cell click. Please find more information here http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_excell_creation.html#grid_cexc.