on 2023 Nov 24 10:59 AM
Hello everyone, I try to create message box with two buttons, one called English and the second called German, to select one of these languages. The names of button should be called from i18n file. I should to write this code only in Component.js file. The Problem is that the message box appears without colors or style. I had tried so much Samples but the same problem appear. also when I had tried to use style.css file!! You can see the photos, one which I want to make like it and the other what I made.
maybe someone can help please?
Thank you
sap.ui.define([ "sap/ui/core/UIComponent", "sap/m/ResponsivePopover", "sap/m/MessageBox"], function(UIComponent, ResponsivePopover, MessageBox) { "use strict"; MessageBox.information( "Select One Of These Languages Please.", { actions: ["ENGLISCH", "DEUTSCH"], title: "Language Selection", emphasizedAction: "ENGLISCH", onClose: function (oAction) {}
Request clarification before answering.
1. The first dialog has the state Error. Yours is Information
2. First is for a newer theme, probably horizon. Your screenshot has an older theme, probably belize. You can change the theme in the Fiori Launchpad on the Settings option after clicking on your profile image. Select horizon (if available) or quartz light.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
mahmood_hammood, as far as I know the strings that you put in "actions" are the same ones that are shown on the screen and also the same given in the onClose event. Therefore, you have to use something like below:
MessageBox.information("Select One Of These Languages Please.", {
actions: [this.getModel("i18n").getResourceBundle().getText("english"), "this.getModel("i18n").getResourceBundle().getText("german")],
title: "Language Selection",
emphasizedAction: "ENGLISCH",
onClose: function(oAction) {
switch (oAction) {
when this.getModel("i18n").getResourceBundle().getText("english"):
......
}
}
});
You're probably still calling the message box outside your controller. Do that in the init function of your controller.
User | Count |
---|---|
60 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.