Hi ,
I want a simple example to handle the mouse move over event and change the color of the row in a grid.
I have a client side events added like this
ColumnHeaderClickHandler="GridHeader_Click"
MouseOverHandler="ReportGrid_MouseOver"
>
{
var cell = igtbl_getCellById(cellId);
cell.style.cursor = 'hover';
}
But the above method is never getting fired nor the colors are changing when I move the mouse over the grid.
Any kind of suggestion is appreciated.
I know it is a bit late, but in case anyone comes here via search - here is a solution to set hover style for rows using MouseOver / Out CSOM client-events, hopefully it will be useful:
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataSourceID="SqlDataSource1" Height="200px" Width="325px"> <DisplayLayout> <ClientSideEvents MouseOverHandler="Over" MouseOutHandler="Out"/> </DisplayLayout></igtbl:UltraWebGrid> <script type="text/javascript" language="javascript"> function Over(gridNane, cellID, objectType) { var cell = igtbl_getCellById(cellID); setRowBackColor(cell.Row, "red"); } function Out(gridNane, cellID, objectType) { var cell = igtbl_getCellById(cellID); setRowBackColor(cell.Row, "white"); } function setRowBackColor(row, color) { var cells = row.getCellElements(); for (var i = 0; i < cells.length; i++) { cells[i].style.backgroundColor = color; } } </script>
I just implemented this and it seems really slow. Is there some way to make the rows change color faster as the mouse moves over them? I would suspect the reason for this being slow is the iteration of cells to change the row color. The the cell iteration would also cause this to get slower the more columns you add which I find an additional problem with this method.
Why isn't there a way to change the style of the TR tag. This would probably solve this problem.