Refresh dataset when returning to view or screen

I have the following case: I must open a dialog, the user enters some values, based on these values a calculation is made in the system. Once the calculation is finished, the dialog is automatically closed. Once the dialog box is closed, the dataset must be refreshed to show the new information.
I have almost everything functional, to complete it I could not refresh the dataset. How can I do it?

I had used this line of code on other occasions to refresh the dataset when closing an editing window, but in this case it does not work.

private CreateAction proyectoTableCreate;

public void init(Map<String, Object> params) {
    proyectoTableCreate.setAfterWindowClosedHandler((window, closeActionId) -> proyectoCollectionDs.refresh());

Probably you open the dialog with the openWindow() method. This method returns the Window interface, which has the addCloseListener() method. So it should be something like this:

Window myDialog = openWindow(...);
myDialog.addCloseListener(actionId -> myDatasource.refresh());