简体   繁体   English

悬停效果上的角剑道网格行

[英]Angular Kendo Grid Row on hover effect

I would like to change the row's background when the user hovers over them (useful help, row tracking). 当用户将鼠标悬停在行背景上时,我想更改行的背景(有用的帮助,行跟踪)。

I tried to apply a CSS class ( <class>:hover ) to every row using [rowClass] , which works in theory, but the style won't get applied. 我尝试使用[rowClass]将CSS类( <class>:hover )应用于每行,这在理论上是[rowClass] ,但是样式不会得到应用。

<kendo-grid [rowClass]="rowCallback" [data]="gridData" [height]="410"> ... <kendo-grid [rowClass]="rowCallback" [data]="gridData" [height]="410"> ...

export class AppComponent {
    public gridData: any[] = products;

    rowCallback(context) {
      return 'styler';
    }
}

Stackblitz: https://stackblitz.com/edit/grid-hover-color-test Stackblitz: https ://stackblitz.com/edit/grid-hover-color-test

The most straight-forward approach would be to target the hovered rows via CSS and add the desired styling, eg: 最简单的方法是通过CSS定位悬停的行并添加所需的样式,例如:

encapsulation: ViewEncapsulation.None,
styles: [`
  .k-grid tr:hover {
    background-color: yellow;
  }
`]

EXAMPLE

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

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