简体   繁体   English

单击gwt单元格表中的一行后,鼠标悬停样式将被删除

[英]Mouse hover style gets removed on click of a row in cell table in gwt

Currently , I am applying mouse hover style to highlight the row of a celltable by using below code snippet. 目前,我正在使用鼠标悬停样式通过使用下面的代码片段突出显示单元格的行。

int rowCount = this.getRowCount();
for(int i=0; i<rowCount; i++){
            TableRowElement rowElement = this.getRowElement(i);
            rowElement.addClassName("selected-row");
        }

.selected-row:hover{
  background-color: #DFE8F6;
}

When i click a row in the cell table, the hover style gets removed, and is not highlighting the row. 当我单击单元格表中的一行时,悬停样式将被删除,并且未突出显示该行。 Can someone suggest please how to retain the hover style, even after clicking of a row. 有人可以建议即使在连续单击后如何保持悬停样式。 Please give some examples. 请举一些例子。

When you click on a row, the table is refreshed, which removes your style. 当您单击一行时,表格将刷新,这将删除您的样式。

GWT already applies a special style to a selected row. GWT已将特殊样式应用于选定的行。 If you don't like the way it looks, you can override GWT's CSS class rather than trying to add your own. 如果您不喜欢它的外观,可以重写GWT的CSS类,而不是尝试添加自己的类。

我也将在鼠标按下事件中添加背景色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM