Hello!
I’m found next feature of table.setVisibleColumns method.
Not sure, this feature is bug, but may be is usefull fo you:
I’m try to fill table and set visible columns:
public void btnRefreshClick(Button.ClickEvent event)
{
System.out.println("btnRefreshClick()");
table.removeAllItems();
table.addContainerProperty("N", Integer.class, null);
table.addContainerProperty("F1", String.class, null);
table.addContainerProperty("F2", String.class, null);
table.addContainerProperty("F3", String.class, null);
table.addContainerProperty("ID", String.class, null);
try
{
for (int i = 0; i < 10; i++)
{
table.addItem(new Object[] { new Integer(i + 1), "Title",
"Title2",
"Title3",
"ID"}, new Integer(i));
}
table.setVisibleColumns(new Object[] { "N", "F1", "F2", "F3"});
} catch (Exception e)
{
e.printStackTrace();
}
}
This code seems ok, but work fine only once!
With second call btnRefreshClick() clear table and leaves empty!
It seems like table.addItem() not work with second call on btnRefreshClick, but problem in …setVisibleColumns!
If I’m try to comment setVisibleColumns line - all work fine, table refresh sucessfull!
I’m found next workaround this issue:
- Set visible all columns
- table.addItems
- Set visible necessary columns
public void btnRefreshClick(Button.ClickEvent event)
{
System.out.println("btnRefreshClick()");
table.removeAllItems();
table.addContainerProperty("N", Integer.class, null);
table.addContainerProperty("F1", String.class, null);
table.addContainerProperty("F2", String.class, null);
table.addContainerProperty("F3", String.class, null);
table.addContainerProperty("ID", String.class, null);
table.setVisibleColumns(new Object[] { "N", "F1", "F2", "F3", "ID"}); // set visible all columns!!!
try
{
for (int i = 0; i < 10; i++)
{
table.addItem(new Object[] { new Integer(i + 1), "Title",
"Title2",
"Title3",
"ID"}, new Integer(i));
}
table.setVisibleColumns(new Object[] { "N", "F1", "F2", "F3"});
} catch (Exception e)
{
e.printStackTrace();
}
}