when I do a item.getItemProperty(“OD”).getValue() I always get null on that property. All other properties of that item on the parent table return values.
It’s hard to see how the property values would be null if you have previously set them as non-null. Do the ChildTables show in the table? How have you created the ChildTables and put them to the main table?
There’s an example of nested tables
here . They are maybe a bit limited use, as they usually need to have fixed height to avoid some rendering trouble.
I took this example and added it to my page. and this is what I tried as below
for ( Object itemId : table.getItemIds() ) {
Property nameProperty = table.getContainerProperty( itemId, “Name”);
Property moonProperty = table.getContainerProperty( itemId, “Moons”);
Item item = table.getItem( itemId );
}
moonProperty which is the child table comes as null.
Ah, I think I know what is happening there. Fascinating.
I don’t know how you test for the null value, but you are probably testing it by somehow calling toString() for the property, not by testing “if (moonPropery == null)”.
That could occur if you are just using the debugger to inspect the values (see below).
So, it results in string “null”, because the toString() in IndexedContainerProperty in IndexedContainer (which is the default container of Table), actually returns toString() of the
value of the property. The value of the property is the child table. A table is a property itself, and its value is the currently selected item of the child table. As there’s no item selected in the child table, it’s null. So, the toString() returns “null”.
I hope that makes it clear. :bashful:
When calling the toString() for the property, it displays some heavy warnings: