<af:resetActionListener/>
Below is an excerpt from the JDeveloper help:
The resetActionListener tag is a declarative way to allow an action source (<commandbutton>, <commandlink>, etc.) to fire a reset action. All values submitted will be reset to null or empty. The reset will not alter any model state directly, rather the enclosing action should have its own actionListener which will reset all model values to their defaults. The resetActionListener tag supports no attributes.In our case, we have a form which is initially displayed as read-only. Invoking Edit button will enable the input components for user edit. Once the the user decided to cancel his edits, he will press the Cancel button and the input components should revert back to their original values.
Example:
This example shows a "Reset..." button. When the button is pressed, all elements on the form will be reset before being applied. The resetModel actionListener will also be called.
<af:commandButton id="reset" text="Reset..." immediate="true" actionListener="#{myUtils.resetModel}"> <af:resetActionListener/> </af:commandButton>Attributes: None.
Below is a snippet from our .jsff page:
<af:commandToolbarButton text="Cancel" id="cb2" actionListener="{viewScope.acctgEntry_edit.cancel}" icon="#{res['cancel_s']}" disabled="#{!pageFlowScope.editMode}" immediate="true"> <af:resetActionListener/> </af:commandToolbarButton>Below is the sample method that resets our model:
public void cancel(ActionEvent actionEvent) { getOperationBinding("findAcctgEntryById").execute(); getPageFlowScope().put("editMode", false); setCurrentTabClean(); }
by, same tone
ReplyDeletein a the user is going to insert a row . so he press insert button.but he didnt enter anything in the row. but he decide cancel the created row.
this my scenario. what i want do? please guide me.
@Subu
ReplyDeleteThe given solution also works for your case. try it.