on 06-01-2022 9:26 AM
Hello experts,
As the title implies, I have to dinamically create(from controller I guess) sections and all their children aggregations inside an objectPageLayout.
All I have now is an oData response which contains two Objects inside an Array, this means I have to create 2 sections containing ObjectPageSubsections and blocks both containing forms inside. How would I go about doing this?
Thanks alot to those who will answer.
Hi,
You can loop your array and use the below code reference inside the loop to create object page dynamically.
var oObjPage = that.getView().byId("__ObjectPageLayout");
//Add Object page Section
var sId = "__" + sType + "HR";
var oSection =
sap.uxap.ObjectPageSection({
titleUppercase: false, id: sId, title: "{i18n>HR_COMMENTS}"
});
oObjPage.addSection(oSection);
//Add SubSection
var oSubSection = new sap.uxap.ObjectPageSubSection({
titleUppercase: false
});
oSection.addSubSection(oSubSection);
//Add a form to Subsection
sId = "__" + sType + "HRForm";
var oForm = new sap.ui.layout.form.SimpleForm(
{
id: sId,
editable: true,
layout: "ColumnLayout",
labelSpanXL: 4,
labelSpanL: 5,
labelSpanM: 5,
labelSpanS: 12,
adjustLabelSpan: false,
emptySpanXL: 0,
emptySpanL: 2,
emptySpanM: 2,
emptySpanS: 0,
columnsXL: 2,
columnsL: 1,
columnsM: 1,
singleContainerFullSize: true
});
oSubSection.addBlock(oForm);
//Add content to form
var sPath = "test”
oForm.addContent(new sap.m.Label({
text: "{i18n>COMMENT_HR}"
}));
oForm.addContent(new sap.m.TextArea({
value: sPath,
enabled: false
}));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.