简体   繁体   English

如何在鼠标悬停时更改网格单元的背景颜色? (GXT)

[英]How to change the background color of a grid cell on mouse over? (GXT)

How can I change the background color of a grid cell on mouse over in GXT (Java) ? 如何在GXT(Java)中的鼠标悬停时更改网格单元的背景颜色?

I want to change the background color of a grid cell when the mouse is over the cell, from the code, not from the CSS. 我想当鼠标悬停在网格上方时,通过代码而不是CSS来更改网格的背景颜色。 Is there a way to do that? 有没有办法做到这一点?

Try this: 尝试这个:

 grid.addStyleOnOver(grid.getElement(), styleClass);

You can get style from *.gss file or create your own style by 您可以从* .gss文件中获取样式,也可以通过以下方式创建自己的样式

StyleInjector.inject(".myStyle {background-color: yellow;}");
grid.addStyleOnOver(grid.getElement(), "myStyle");

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

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