Refresh button for windowActions

Is there any possibility to add a new Refresh button (in addition to OK and Cancel) for windowActions?
The idea is to refresh all data belong to a window.
I know that is possible related to a table but in my case there is no table.
Basically I need to refresh price value related to Start date and End date.

image

Add a button:

<hbox id="editActions"
      spacing="true">
    <button action="windowCommitAndClose"/>
    <button action="windowClose"/>
    <button id="discardBtn" caption="Discard"/>
</hbox>

Subscribe to the click event and reload the entity:

@Inject
private InstanceLoader<Customer> customerDl;

@Subscribe("discardBtn")
private void onDiscardBtnClick(Button.ClickEvent event) {
    customerDl.load();
}
1 Like

Where should I declare component (instance) loader?

image

import com.haulmont.cuba.gui.model.InstanceLoader;
import com.haulmont.cuba.gui.screen.Subscribe;

I’ve tried under <datasource… but doesn’t work.

https://doc.cuba-platform.com/manual-7.0/gui_data_loaders.html

Yes I saw but unfortunately doesn’t work (stays in red).
Could you give me an example, please?

Look at quick start.
You can also just create a browser or editor screen for an entity with Studio and see how it is defined.