CIC92 CIC92 - 2 months ago 33
Javascript Question

how to add label inside expanded panel sapui5

Hi I have a dialog witch contains a panel that I should expand it and display a text / label or another controller with some text.
I managed to do the panel stuff but I don't know how to display the label inside the expanded panel.(I can't find any examples made in js without doing it in xml)

here is my code:

var panel = new sap.m.Panel("panel-1", {
/* justifyContent : sap.m.FlexJustifyContent.Center,*/
width : '100%',
expandable: true
var dialog = new Dialog({
title: "There was an error while trying to resend the message",
contentWidth: "500px",
resizable: true,
type: 'Message',
state: 'Error',
/*content: new sap.m.Label({
id : 'labeldialog',
justifyContent : sap.m.FlexJustifyContent.Center,
text: JSON.parse(oError.response.body).error.message.value,
content: [panel],

beginButton: new sap.m.Button({
text: 'Close',
press: function () {

afterClose: function() {

What should I use to achieve a control in such a way to put a string or a parameter in the collapsed part. thank you.

enter image description here


Did you try this?

var panel = new sap.m.Panel("panel-1", {
                width : '100%',
                expandable: true,
                content: [ new sap.m.Text("someId", { "Your message here" })]