I am trying to update a row style for on mouse hover.
mappings.addCellPreviewHandler(new Handler<MappingInstructionVO>() {
@Override
public void onCellPreview(CellPreviewEvent<MappingInstructionVO> event) {
if (BrowserEvents.MOUSEOVER.equals(event.getNativeEvent().getType())) {
mappings.getRowElement(event.getValue().getExecutionOrder()).getStyle().setBorderColor("Red");
}
});
I am able wo get row content successfully using:
mappings.getRowElement(event.getValue().getExecutionOrder() - 1).getInnerText());
Any idea why
mappings.getRowElement(event.getValue().getExecutionOrder()).getStyle().setBorderColor("Red");
has no effect?
Thanks
DataGrid has dataGridHoveredRow
style defined in its default DataGrid.Resources
. One option is to override this style in your own ClientBundle.
Otherwise, try
.getStyle().setProperty("border", "1px solid red");
EDIT:
You must set "border-collapse: collapse" on your DataGrid.
From the CSS2 specification:
In [the border-collapse: separate model], each cell has an individual border. [...] Rows, columns, row groups, and column groups cannot have borders (i.e., user agents must ignore the border properties for those elements).