188.8.131.52. Using initNewItem Method
Initial values can also be defined in the initNewItem() method of the screen controller of the created entity.
Consider the following entities:
In the demo application,
CustomerDetails attribute (
info) is edited on the same screen as
Customer itself. It requires creating of a
CustomerDetails instance together with the owning
customer-edit.xml - a customer edit screen descriptor. It contains a nested datasource for a linked
infoFieldtext area component is connected to this datasource.
CustomerEdit.java - the screen controller. It defines the
initNewItem()method that creates a new
CustomerDetailsinstance and sets it to a new
Customer. The created instance will be available through the nested datasource and later saved to the database when the screen is committed.