GWT:如何更改GWT Celltable中的行颜色 [英] GWT:how to change row color in GWT Celltable

查看:107
本文介绍了GWT:如何更改GWT Celltable中的行颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GWT中有一个celltable,我可以通过这个改变特定列的颜色。

i have a celltable in GWT, I can change color of a specific column by this

            celltable.addColumnStyleName(4, "bluetext");

但是我怎样才能改变颜色的第3行

but how can i change for example color of row No 3

谢谢

Thanks

推荐答案

您必须提供 RowStyles 返回每行的css类名称的对象。所以,为一行设置一个特定的颜色,你必须用这种颜色定义一个css类,然后让你的 RowStyles 对象返回相关的类行。

You have to provide a RowStyles object that returns css class names for each row. So, to set a particular color for a row, you'd have to define a css class with that color, and then cause your RowStyles object to return that class for the relevant rows.

我想你可以用 cellTable.setRowStyles 或类似的东西来设置它。

I think you set this with cellTable.setRowStyles or something similar.

cellTable.setRowStyles(new RowStyles<T>() {
    @Override
    public String getStyleNames(T rowObject, int rowIndex) {
        if (rowIndex == 3) {
            return "bluetext";
        } else {
            return "normaltext";
        } 
    });

这篇关于GWT:如何更改GWT Celltable中的行颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆