RefreshAction

RefreshAction is a list action designed to reload the data container used by the table or tree component.

The action is implemented by the io.jmix.ui.action.list.RefreshAction class and should be defined in XML using type="refresh" action’s attribute. You can configure common action parameters using XML attributes of the action element. See Declarative Actions for details.

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 custom confirmation dialog before executing the action:

@Named("custTable.refresh")
private RefreshAction refreshAction;

@Subscribe("custTable.refresh")
public void onCustTableRefresh(Action.ActionPerformedEvent event) {
    dialogs.createOptionDialog()
            .withCaption("Please confirm")
            .withMessage("Are you sure you want to refresh the list?")
            .withActions(
                    new DialogAction(DialogAction.Type.YES)
                            .withHandler(e -> refreshAction.execute()), // execute action
                    new DialogAction(DialogAction.Type.NO)
            )
            .show();
}

You can also subscribe to ActionPerformedEvent, and instead of invoking the action’s execute() method, trigger the data loader directly. For example:

@Autowired
private CollectionLoader<Customer> customersDl;

@Subscribe("custTable.refreshAction")
public void onCustTableRefreshAction(Action.ActionPerformedEvent event) {
    customersDl.load();
}