cancel
Showing results for 
Search instead for 
Did you mean: 

Use Function from one controller to the other, possible ?

0 Kudos
206

Hello there,

I am currently stuck with something, nobody in the World might have ever had to do.

I have 3 Controllers, and i want the 3rd to use a function from the first.

here is how it looks:

this is my Master controller, it has a function called "onRefresh" which i want triggered.

This is the Detail Controller with a function call to the Dialog.

and this, finally is my ApprovalDialog controller, from which i want the ListRefresher to be executed for the Master View as soon as the confirm Button is triggered. I just don't know how this can be done, or if at all.

Do you know if there is an Answer ?

Thanks warmHeartedly in advance!

View Entire Topic
juantorresv
Explorer

You could use event bus, but if what you want to do is to refresh the master list after success the request then you can do this:

MessageBox.show(
				"Message you want to show", {
					icon: oMessageBox.Icon.SUCCESS,
					onClose: function() {
						oModel.setRefreshAfterChange(true);
						oModel.refresh(true);
						oModel.attachEventOnce("requestCompleted", function() {
							navBack();
						});
					}
				}
			);

With this, you ensure to refresh and only after the request is completed to go back.

Greetings.