action “send to app” not working
-
Klaus79
5 years ago #19824I do not get a channel from following code snippet.
var oChannel = getChannel(this, sChannelId);
if (!oChannel) {
// no channel
if (Log.isLoggable(Log.Level.DEBUG, “sap.ui.core.EventBus”)) {
Log.debug(“Failed to publish into channel ‘” + sChannelId + “‘.” + ” No such channel.”, sChannelId, “sap.ui.core.EventBus”);
}
return;
}Problem is following line: getChannel(this, sChannelId);
getChannel returns ‘undefined’.
sChannelId = Password_ModulToApp
which channel/data is missing?
Klaus79
5 years ago #19825::there is no ‘Password_ModulToApp’ in oEventBus (see below).
Name of ‘sChannelId’ is generated by Simplifier.
oEventBus._mChannels
[object]
__proto__[object]
ApplicationChannel[object (constructor)]
Home[object (constructor)]
Login[object (constructor)]
Main[object (constructor)]
sap.ui[object (constructor)]
Screen_Approval[object (constructor)]
Screen_Infosystem[object (constructor)]
Screen_Main[object (constructor)]
Screen_Password[object (constructor)]
Screen_Roles[object (constructor)]
Screen_StatusDialog[object (constructor)]
Screen_User_Maintain[object (constructor)]
Screen_valueHelp_Customer[object (constructor)]
SuperAdministration[object (constructor)]
Mathieu Roll
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
Has successfully completed the online course Basics (100)
Klaus79
5 years ago #19832::No, nothing changed.
sap.ui.getCore().getEventBus().publish(this.getModuleName() + “ToApp”, “statusMessage”, adataForstatusMessage);
the generated code “this.getModuleName() + “ToApp” creates in my oppinion the wrong channel name <modul_name>+”ToApp” (results in my example in: “Password_ModulToApp”
But if i change it to “Screen_StatusDialog” (channel will be found now) I get another error “no event is registered” (see Simplifier code below).
var aEventListeners will be ‘undefined’.
var aEventListeners = EventProvider.getEventList(oChannel)[sEventId];
if (Array.isArray(aEventListeners)) {
// this ensures no ‘concurrent modification exception’ occurs (e.g. an event listener deregisters itself).
aEventListeners = aEventListeners.slice();
var oInfo;
for (var i = 0, iL = aEventListeners.length; i < iL; i++) {
oInfo = aEventListeners[i];
this._callListener(oInfo.fFunction, oInfo.oListener || this, sChannelId, sEventId, oData);
}
} else if (Log.isLoggable(Log.Level.DEBUG, “sap.ui.core.EventBus”)) {
// no listeners
Log.debug(“Failed to publish Event ‘” + sEventId + “‘ in ‘” + sChannelId + “‘.” + ” No listeners found.”, sChannelId + “#” + sEventId, “sap.ui.core.EventBus”);
}Armin Winkler
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
Has successfully completed the online course Basics (100)
You must be logged in to reply to this topic.