Hello,
I searched the forum but couldn’t find an answer so here’s my issue:
I have a StandardEditor screen on the “Bill” object.
In the XML, I also have the following:
<button id="draftButton" action="windowCommitAndClose" caption="Save as Draft"/>
<button id="openButton" action="windowCommitAndClose" caption="Save as Open"/>
<button action="windowClose" caption="Cancel"/>
</hbox>
What I’m trying to do is if the user clicks on “Save as Draft”, then I will update the entity as
bill.setStatus = “Draft” and close the screen.
if the user clicks on “Save as Open”, then I will update the entity as bill.setStatus = “Open” and close the screen.
How can I accomplish this?
thanks.
Override the commitAndClose method, which is default ActionPerformedEvent handler for the windowCommitAndClose action and check which button was clicked in particular.
@Override
protected void commitAndClose(Action.ActionPerformedEvent event) {
Component component = event.getComponent();
// Check component id or something...
super.commitAndClose(event);
}
Assign an individual action for each button. The default commitAndClose method implementation is pretty straightforward, it calls closeWithCommit(), so it costs nothing to implement such action from scratch.