计算列 vaadin 中的项目

count items in a column vaadin

大家好!

如何获取列包含的项目数?我想要 如果 "Workgroup" 列为空,则隐藏它,我只是不知道该怎么做。

            Table tblTeachings = new Table();
            tblTeachings.addContainerProperty("#", Integer.class,0);
            tblTeachings.addContainerProperty("Course",String.class,"");
            tblTeachings.addContainerProperty("Teaching name",String.class,"");
            tblTeachings.addContainerProperty("Start date",String.class,"");
            tblTeachings.addContainerProperty("End Date",String.class,"");
            tblTeachings.addContainerProperty("Activity status",String.class,"");
            tblTeachings.addContainerProperty("Participated",String.class,"");
            tblTeachings.addContainerProperty("Workgroup",String.class,"");
            tblTeachings.setSizeFull();

            if(/*I don't know what condition should I put here*/){
                //hide the emptycolumn
            } 

谢谢!

列不包含项目, 行包含项目。

您可以通过将数组传递给 setVisibleColumns methos of the Table 来设置可见列。

这也可能是一个想法,只是折叠列,而不是隐藏它...

确定该列的所有值是否为空对您来说应该很简单。如果不是,请告诉我们您使用的是什么数据源。