2015-06-22 73 views
0

大家好!計數項目列vaadin

如何獲取某列中包含的項目數量?我想 隱藏「工作組」列,如果它是空的,我只是不知道如何。

  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 
      } 

謝謝!

+0

我建議給這個閱讀和調整你的代碼。 https://docs.oracle.com/javase/tutorial/uiswing/components/table.html 你應該爲你的'Table'使用另一個構造函數。 –

+0

這是一個vaadin表,而不是一個擺動表。 – triForce420

回答

1

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

您可以通過將數組傳遞給setVisibleColumns methos of the Table來設置可見列。

它也可能是一個想法,只是COLAPSE列,而不是隱藏它...

確定是否該科拉姆的所有值都爲空應該是簡單enogh你。如果沒有,請告訴我們您使用的是什麼數據源。

+0

謝謝!我以爲我可以直接檢查列的「大小」。 – triForce420