dhtmlxGrid - Changing Selected Cell Styles

How do you change the text color or text style on one cell or a series of cells with an event handler such as onMouseOver?



Is there a onMouseDown event for a selected cell?



Thanks in advance for your help.

How do you change the text color or text style on one cell or a series of cells with an event handler such as onMouseOver?

Basically, you can use code similar to next
var old="";
grid.attachEvent(“onMouseOver”,function(id,ind){
       var cell=grid.cells(id,ind).cell;
       if (cell!=old){
          if (old) old.className="";
          cell.className=“cell_under_mouse”;   // assign any custom styles to cell under mouse
          old=cell;
      }
     return true;
})


>>Is there a onMouseDown event for a selected cell?
There is no special “onMouseDown”, but you can use use onRowSelect

grid.attachEvent(“onRowSelect”,function(id,ind){
     if (id== grid.getSelectedId() && ind==grid.getSelectedCellIndex() ) alert(“selected cell was clicked”);
    return true;
})

The code works great for a single cell, but how would I change the style for a group of cells onMouseOver of a single cell?

One, Can I avoid looping thru all the cells to update the class of the grouped cells.

Two, can I change the color attribute of the class (as opposed to changing the class for each cell in the group)?

style for a group of cells onMouseOver of a single cell
The grid provides API to set some style to all rows in some cell, but there is no support for group processing any other kind of cell groups.


>>One, Can I avoid looping thru all the cells to update the class of the grouped cells.
In common case, you will need to loop through all rows (  dhtmlx.com/docs/products/dht … _grid.html )

>>Two, can I change the color attribute of the class (as opposed to changing the class for each cell in the group)?
Basically you can change the style property directly
    cell.style.backgroundColor=“red”;
Please beware that color set in such manner will override the color of selected row|cell