Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Richard on Jul 16, 2008 12:26
open dhtmlx forum
onclick event for readonly cell

READ THIS ENTIRE MESSAGE, PLEASE.

I am using dhtmlxGrid v.1.4 Standard edition build 71106


I know that there is no onclick event raised for read only cells and that we normally have to rely on the onRowSelected event to perform tasks. I needed row headers, so I am doing just that.

My users click on a row header cell to 'select' the row (not using your multi-selection functionality for a few reasons) and this works fine. The roadblock I've run into is that my users want to press shift-click to select a range of rows or control-click to select multiple non-contiguous rows.

I thought that the way I'd be able to do this is by capturing the onclick event but it isn't present by the time my rowselect handler is called. Is there anything I can do in this situation?
Answer posted by Support on Jul 17, 2008 05:21
You can attach custom code to native DOM event, and receive all necessary info.
Can be done similar to next

grid = new...
...
grid.init()
var status={}
dhtmlxEvent(grid.objBox,"click",function(e){
    status={
        shift:(e||event).shiftKey,
        ctrl:(e||event).ctrlKey
     }
});
grid.attachEvent("onRowSelect",function(id){
    //status will contain states for ctrl and shift key
    if (status.ctrl ) do_something();
    return true;
});