After Dialog close at vaadin 16

hi.after i close dialog i wanna refresh my grid automatically.i couldnt yet.plz help me?

before i set grid’s Listdataprovider and call dialog class for new record.i insert new record and close dialog.when i close it ,i try to refresh grid but it can’t.
i try gridPcAlimi.getDataProvider().refreshAll(); Not RUN
i try Listdataprovider reset but Not RUN.
Thank you

Hi there,

there may be several reasons for your problem. It would be helpful if you could post your code.

private void newBuy() { //in mainview

    NewBuy newBuy = new NewBuy();
    newBuy.setTitle("Buying");
   
    newBuy.open();
	//call dialog
}

public class NewBuy extends Dialog {

 private void new_alim_save() {
    try {
        //save to DB
        );
      
        close();
     


    } catch (Exception ex) {
        Notification notification = new Notification("Error" + ex.getMessage(), 3000);
        notification.open();

    }

}

}

how can we find out whether dialog is closing in Mainview?

Is this what you are looking for:

newBuy.addOpenedChangeListener(change -> {
					if(change.isOpened()) {
						return;
					}
					gridPcAlimi.getDataProvider().refreshAll()
				});

tnx a lot Doug Yachera.