I started to use nested data containers. That is pretty nice but doesn’t seam to update right if the nested container is a collection container.
I’ve build a screen with
<data>
<instance id="orderDc"
class="com.company.example.Order">
<instance id="customerDc" property="customer"/>
<collection id="lineItemsDc" property="lineItems"/>
</instance>
</data>
When loading the screen this works fine and order, customer and line items are inside its containers. But when adding an item programmatically to orderDc
e.g. with orderDc.getItem().getItems().add(dataManager.create(LineItem.class))
this is not inside lineItemsDc
and does not appear on the screen. If I do it other way around with itemsDc.getMutableItems().add(dataManager.create(LineItem.class))
the new item is also in orderDc
.
I wanted to use the orderDc
to manage the different items on the screen and that works for the customer but not for the line items.
Is the idea wrong, to set a nested collection via parent entity?