Hi, in a MASTER / DETAIL screen, how can insert a button in the DETAIL screen “Save and New” that updates the list in the MASTER screen and clear the data in the DETAIL screen for a new entry without closing the DETAIL screen?
Thank’s
Hello @massimo,
Set visible = "true"
for the following element in the XML descriptor:
<hbox id="actionsPane" spacing="true" visible="true">
<button id="saveBtn" action="save"/>
<button id="cancelBtn" action="cancel"/>
</hbox>
And override MasterDetailScreen#initEditComponents
method in screen controller:
@Override
protected void initEditComponents(boolean enabled) {
TabSheet tabSheet = getTabSheet();
if (tabSheet != null) {
ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
if (component instanceof FieldGroup) {
((FieldGroup) component).setEditable(enabled);
} else if (component instanceof Table) {
((Table) component).getActions().forEach(action -> action.setEnabled(enabled));
} else if (!(component instanceof ComponentContainer)) {
component.setEnabled(enabled);
}
});
}
getForm().setEditable(enabled);
getActionsPane().setVisible(true); // actions panel will always be visible
getLookupBox().setEnabled(!enabled);
}
Regards,
Gleb
Thanks for the info - I’ll try