Hidden column in TreeTable

Hello everyone.
I’d like to hidden a column in the treetable. How can i do?
This is my class

public class TreeTableDataSet extends TreeTable {

public HierarchicalContainer initialize(){
HierarchicalContainer container = new HierarchicalContainer();
container.addContainerProperty(NAME_PROPERTY, String.class, “”);
container.addContainerProperty(CONTENT_PROPERTY, String.class, “”);
container.addContainerProperty(HIDDEN_PROPERTY, String.class, “”);
return container;

}

public void createView() {
	Object row;
    row = dataSource.addItem();
	dataSource.getContainerProperty(row , NAME_PROPERTY).setValue("MSGID");
	dataSource.getContainerProperty(row , CONTENT_PROPERTY).setValue("");
	
	setContainerDataSource(dataSource);
	setItemCaptionPropertyId(NAME_PROPERTY);
	setItemCaptionPropertyId(CONTENT_PROPERTY);
	//setVisibleColumns(new Object[] {NAME_PROPERTY, CONTENT_PROPERTY});
	
}

}

How I can hidden HIDDEN_PROPERTY and display only NAME_PROPERTY and CONTENT_PROPERTY?

Thanks a lot.

Vito

Is it impossible?

OK
Thanks a lot

Doesn’t

setVisibleColumns(new Object[] {NAME_PROPERTY, CONTENT_PROPERTY});

work? It should.

thank you very much for your replay but it don’t work.

I’ve tried it in fact I have commented that statement to show it too.

setVisibleColumns() should work as long as you do it after setContainerDataSource(). However, it is more efficient to give that object array as the second parameter to setContainerDataSource() - you could try that as well.

If it does not work, what is the type of your property constants? Could they have an invalid equals() or hashCode() method or something like that?

  • setVisibleColumns() is after setContainerDataSource()
  • what is the type of your property constants? They are String
    Here is the treetable class:

public class MyTreeTable extends TreeTable {

protected static final String NAME_PROPERTY = “Message”;
protected static final String CONTENT_PROPERTY = “Content”;
protected static final String HIDDEN_PROPERTY = “Hidden”;

public HierarchicalContainer initialize(){
HierarchicalContainer container = new HierarchicalContainer();
container.addContainerProperty(NAME_PROPERTY, String.class, “”);
container.addContainerProperty(CONTENT_PROPERTY, String.class, “”);
container.addContainerProperty(HIDDEN_PROPERTY, String.class, “”);
return container;

}

public void createView() {
Object row;
row = dataSource.addItem();
dataSource.getContainerProperty(row , NAME_PROPERTY).setValue(“MSGID”);
dataSource.getContainerProperty(row , CONTENT_PROPERTY).setValue(“”);
setContainerDataSource(dataSource);
//setItemCaptionPropertyId(NAME_PROPERTY);
//setItemCaptionPropertyId(CONTENT_PROPERTY);
setVisibleColumns(new Object {NAME_PROPERTY, CONTENT_PROPERTY});

}
}