Skip to Content
0

How to asynchronize(run one after another) two methods in sapui5?

Oct 04, 2017 at 09:44 AM

53

avatar image
Former Member

In a scenario I have to call the second methods after completion of first method.
After updating an Order from Fiori app I am refreshing the model to get the updated data using refresh() method.
After completion of refresh() method I want to call another method. Since the refresh method loads the data from backend, it takes time to complete and my second method is being called before the completion of refresh method.

this.getView().getModel().refresh();
this.someMethod();

Please let me know if there is any way to call them one after another(after completion of first method).

Regards,

Amit

10 |10000 characters needed characters left characters exceeded
0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Oct 04, 2017 at 12:25 PM
2

Hi Amit,

You can attach the second method to the event requestCompleted of OData model. Please check the below API:

https://sapui5.hana.ondemand.com/1.44.14/#docs/api/symbols/sap.ui.model.odata.v2.ODataModel.html#event:requestCompleted

Share
10 |10000 characters needed characters left characters exceeded