Vaadin Grid Table:如何为某些列绘制边框? [英] Vaadin Grid Table: how to draw border for certain columns?

查看:631
本文介绍了Vaadin Grid Table:如何为某些列绘制边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Vaadins Grid表进行数据表示。
因此,我想为 Employee -ID-列的右边框以及名称的两个边框绘制粗线名称姓氏列。



结果应该如下所示:





我如何管理它? 继续从


I'm using Vaadins Grid table for data representation. Therefore I want to draw a thick line for the right border of the Employee-ID-column and for both border sides of the name or name and surname column.

The result should look like this:

How I can manage that?

解决方案

Continuing from where we left off in your other question regarding cell background, update your CellStyleGenerator to handle your other columns. For the sake of brevity I'll just demo a column with both borders, but you'll get the idea:

grid.setCellStyleGenerator(new Grid.CellStyleGenerator() {
    @Override
    public String getStyle(Grid.CellReference cellReference) {
        if ("c1".equals(cellReference.getPropertyId())) {
            return "green";
        } else if ("c2".equals(cellReference.getPropertyId())) {
            return "right-and-left-border";
        } else {
            return null;
        }
    }
});

... add the appropriate styles in your theme file:

.v-grid-cell.right-and-left-border {
  border-left: solid 2px black;
  border-right: solid 2px black;
}

... and you should get something similar to:

这篇关于Vaadin Grid Table:如何为某些列绘制边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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