cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Event Bus issue

former_member225463
Participant
0 Kudos
446

Hi All,

I am using the concept of Event bus to make communication between two controllers :

I have publish in one controller :

goToInbox: function() { // to handle the page refresh. changes done by rakshit_x

var oEventBus = sap.ui.getCore().getEventBus();

oEventBus.publish("master", "onNavBackLoad");

// Route back to First screen

var oRouter = sap.ui.core.UIComponent.getRouterFor(this); oRouter.navTo("ClaimInboxMaster"); }

The Subscribe in another controller :

sap.ui.getCore().getEventBus().subscribe("master", "onNavBackLoad", this.onNavBackLoad, this);

which calls the function :

onNavBackLoad: function() {

var _self = this; showBusy();

sap.ui.core.BusyIndicator.show(0); //$.when(_self.status(_self)).done(function() { $.when(_self.getMasterData()).done(function() {

var list = _self.getView().byId("claimHeader");

list.getBinding("items").filter([]);

_self.byId("statusSelect").setSelectedKey("All");

if (list.getItems().length > 0) { list.setSelectedItem(list.getItems()[0], true, true); } }); // }); },

Inside the above function i am calling getmasterdata function where it has to to a call to the backend. The issue i am facing is sometimes its works fine. but sometimes odata is not getting initialized and giving an error of undefined.

var oDataModelRead = this.getOwnerComponent().getModel("oDataModelSRV"); sometimes works where as sometimes don't work. Please help me on this to resolve the issue.

Thanks

Accepted Solutions (0)

Answers (0)