ValueClearAction
ValueClearAction
is a value picker action designed to clear the value of ValuePicker.
The action is implemented by the io.jmix.ui.action.valuepicker.ValueClearAction
class and should be defined in XML using type="value_clear"
action’s attribute. You can configure common action parameters using XML attributes of the action element. See Declarative Actions for details.
Using ActionPerformedEvent
If you want to perform some checks or interact with the user before the action is executed, subscribe to the action’s ActionPerformedEvent
and invoke the execute()
method of the action when needed. In the example below, we show a confirmation dialog before executing the action:
@Named("valuePicker.clear")
private ValueClearAction valuePickerClear;
@Subscribe("valuePicker.clear")
public void onValuePickerClear(Action.ActionPerformedEvent event) {
dialogs.createOptionDialog()
.withCaption("Please confirm")
.withMessage("Do you really want to clear the field?")
.withActions(
new DialogAction(DialogAction.Type.YES)
.withHandler(e -> valuePickerClear.execute()), // execute action
new DialogAction(DialogAction.Type.NO)
)
.show();
}
Was this page helpful?
Thank you for your feedback