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:

private ValueClearAction valuePickerClear;

public void onValuePickerClear(Action.ActionPerformedEvent event) {
            .withCaption("Please confirm")
            .withMessage("Do you really want to clear the field?")
                    new DialogAction(DialogAction.Type.YES)
                            .withHandler(e -> valuePickerClear.execute()), // execute action
                    new DialogAction(DialogAction.Type.NO)