【发布时间】:2016-02-29 21:15:11
【问题描述】:
当鼠标在它上面时,我想突出显示一整行 angular-ui-grid。
我尝试通过添加设置背景颜色的 ng-mouseover 和 ng-mouseleave 回调来修改 rowTemplate。
这是我的 rowTemplate——我希望前三行将整个行颜色更改为红色。但只有当前鼠标下的单元格会发生变化。
<div
ng-mouseover="rowStyle={'background-color': 'red'}; grid.appScope.onRowHover(this);"
ng-mouseleave="rowStyle={}"
ng-style="rowStyle"
ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.uid"
ui-grid-one-bind-id-grid="rowRenderIndex + '-' + col.uid + '-cell'"
class="ui-grid-cell"
ng-class="{ 'ui-grid-row-header-cell': col.isRowHeader }"
role="{{col.isRowHeader ? 'rowheader' : 'gridcell'}}"
ui-grid-cell>
</div>
如何在鼠标悬停事件中突出显示整行?
我尝试的另一种方法:使用一些回调函数来执行此操作——例如示例中的 appScope.onRowHover。在这里,我有悬停在行的范围。如何在 onRowHover 函数中设置该行的样式?
谢谢!
Link to Plunkr。我希望将鼠标悬停在网格单元上会使整行变为红色。
【问题讨论】: