I have three container properties for TreeTable
.
addContainerProperty("caption", String.class, null);
addContainerProperty("value", String.class, null);
addContainerProperty("deleted_flag", boolean.class, false);
setVisibleColumns("fields", "ids");
One of them should contain value - but don't want to display it all so I set visibile columns only to first two properties. Yet I want to have a value for the last property.
Whe I add item to the table like this
Object itemId = addItem(new Object[]{caption, value, isDeleted}, UUID.randomUUID().toString());
It returns itemId
as null
. If I add item like this
addItem(new String[]{caption, value}, UUID.randomUUID().toString())
it works ok and return UUID
.
What is the problem? As far as I understand it is due to addItem
method that expects only visibile values in the array. Then how to set the invisible value?
It seems it can be done like this
First I changed property type from primitive to object
addContainerProperty("deleted_flag", Boolean.class, false);
Then after adding item I get item and set property value
Object id = addItem(new Object[]{caption, value}, UUID.randomUUID().toString());
getItem(id).getItemProperty("deleted_flag").setValue(isDeleted);