How to set default values for a screen in V7

Hi,

In 6.x , the document include a part for assigning initial values.

image

But seems it is outdated.
Fox example,In CUBA 7 ,the screen use StandardEditor, there is no initNewItem method.

Finally ,i figure out the problem using the setEntityToEdit method.
image

For assigning initial value ,is there a document in V7 ?

Hi,
I think i found the description for assigning initial values.
https://doc.cuba-platform.com/manual-7.0/screen_controller_events.html

1 Like

Use InitEntityEvent in StandardEditor and MasterDetailScreen:

@Subscribe
protected void onInitEntity(InitEntityEvent<Foo> event) {
    event.getEntity().setStatus(Status.ACTIVE);
}
1 Like

Hi, Yuriy

Thanks a lot.

The examples of initializing data in screens will be moved from the documentation to the Guides shortly.