on 2019 Jul 25 3:40 PM
Hello All,
I am getting Error while using Event Bus (Subscribe and Publish).
So When the application is loaded first time from the launchpad , below code works perfectly.
But When i go back to my launchpad and come again to the app it is not working.
Error is
datajs-dbg.js:7960 Uncaught TypeError: Cannot read property 'refresh' of undefined at f.onRefresh1 (Master.controller.js?eval:1) at constructor.a.publish (EventBus-dbg.js:211) at success (Detail.controller.js?eval:1) at _ (ODataModel-dbg.js:1653) at ODataModel-dbg.js:3252 at datajs-dbg.js:1634 at p9 (datajs-dbg.js:2539) at Object.request (datajs-dbg.js:2591) at E2 (datajs-dbg.js:1612) at Object.o.request (datajs-dbg.js:7954)
// ------------------------------------ In Master Page ---------------------
onInit : function () {
var oEventBus = sap.ui.getCore().getEventBus();
oEventBus.subscribe("Master", "onRefresh1", this.onRefresh1 , this);
},
onRefresh1 : function () {
this._oList.getBinding("items").refresh();
var eventBus1 = sap.ui.getCore().getEventBus();
eventBus1.publish("Detail","_bindView");
},
// ------------------------------------ In Detail Page ---------------------
onSave : function () {
var eventBus = sap.ui.getCore().getEventBus();
eventBus.publish("Master","onRefresh1");
}
Can you please guide me what wrong I am doing?
Thanks in Advance.
Regards,
Sujoy
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Its is working now for me now. I just added below code.
var _oComponent = this.getOwnerComponent();
var oList = _oComponent.oListSelector._oList;
var oListBinding = oList.getBinding("items");
oListBinding.refresh(true);
var eventBus1 = sap.ui.getCore().getEventBus();
eventBus1.publish("Detail","_bindView");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
22 | |
9 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.