Best way to set cell onmouseover style
Hi everyone,
I have a grid which has alternate rows styled with:
and with the row selector enabled:
In one particular column (col 8) I want to have an additional style effect which is a cell background color change when the mouse is over a cell. This is what I've got so far:
This nearly works but not quite. It changes the background of the cell when hovered over and changes it back again to the correct odd/even background OK. Where it fails, however, is when a row is selected (that has previously had column 8 hovered over) then the selected row style (white text color on blue background) disappears on that cell (OK on the rest of the row).
What I need to be able to do I think is somthing like "reset" the class .aw-row-selected for the cell that has been previouslyhovered over.
I can't help thinking that there must be more elegant & efficient ways of doing all this.
If anybody has any ideas on this your input would be gratefully received as always.
WIll
I have a grid which has alternate rows styled with:
.aw-alternate-even {background: #fff;}
.aw-alternate-odd {background: #eee;}
and with the row selector enabled:
obj.setSelectionMode("single-row");
In one particular column (col 8) I want to have an additional style effect which is a cell background color change when the mouse is over a cell. This is what I've got so far:
obj.onCellMouseOver = function(event, column, row){
if(column == 8) {
obj.getCellTemplate(column, row).setStyle("background","#bbb");
}
};
obj.onCellMouseOut = function(event, column, row){
if(column == 8) {
// test for whether row number is odd or even
// if modulus is zero condition is false
var row_position = obj.getRowPosition(row);
if (row_position%2) {
obj.getCellTemplate(column, row).setStyle("background","#eee");
}
else {
obj.getCellTemplate(column, row).setStyle("background","#fff");
}
}
};
This nearly works but not quite. It changes the background of the cell when hovered over and changes it back again to the correct odd/even background OK. Where it fails, however, is when a row is selected (that has previously had column 8 hovered over) then the selected row style (white text color on blue background) disappears on that cell (OK on the rest of the row).
What I need to be able to do I think is somthing like "reset" the class .aw-row-selected for the cell that has been previouslyhovered over.
I can't help thinking that there must be more elegant & efficient ways of doing all this.
If anybody has any ideas on this your input would be gratefully received as always.
WIll
Will
April 4,