Hello,
using JMix 1.5,
having browser and edit screen (not master-detail) for a certain entity,
I want a user to only add data.
So when he clicks the menu item,
browser screen opens,
then with createBtn.click() in onAfterShow I open the edit screen.
Now,
when the user leaves the edit screen (with or without commit) the browser screen should close itself.
When the user clicks either cancel or ok, you can publish an event, and the browse screen has an event listener that will close it.
But what if the user wants to create more then one record?
I just realized, you don’t need to open the browse screen at all, you just want to directly insert a record.
So just edit the Main Menu and add your edit screen, just like the browse screen is already there.
<item screen="ExampleEntity.edit"
caption= "Edit example entity"/>
You can keep your browse screen too if needed (and assign appropriate access), just remove that onAfterShow handler.
In your example above, you open the browse screen, and directly after the edit screen, but a user can navigate back to the browser screen with breadcrumbs …
The docs give an example with programmatic opening of a browse screen, but it’s the same for editor, you just need to provide an entity instance to edit.