Skip to content

Commit

Permalink
[FIX] SimpleForm: use aggregation forwarding for toolbar
Browse files Browse the repository at this point in the history
So the Toolbar is also cloned by cloning the SimpleForm.

BTW, this cannot be done for the Title as there also a simple string can be provided.

Change-Id: Ic980306cbe02eb48f7e0b1af7cac6095d17337ec
BCP: 2370120590
  • Loading branch information
UserAbcd1234 committed Oct 19, 2023
1 parent 84d5929 commit a8a8199
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ sap.ui.define([
"sap/ui/commons/CheckBox",
"sap/ui/commons/TextArea",
"sap/ui/commons/layout/ResponsiveFlowLayoutData",
"sap/ui/layout/form/GridContainerData",
"sap/ui/layout/form/GridElementData",
"sap/ui/commons/library"
], function(
createAndAppendDiv,
Expand All @@ -22,6 +24,8 @@ sap.ui.define([
CheckBox,
TextArea,
ResponsiveFlowLayoutData,
GridContainerData,
GridElementData,
commonsLibrary
) {
"use strict";
Expand Down
24 changes: 9 additions & 15 deletions src/sap.ui.layout/src/sap/ui/layout/form/SimpleForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,12 @@ sap.ui.define([
* In this case add the <code>Title</code> to the <code>ariaLabelledBy</code> association.
* @since 1.36.0
*/
toolbar : {type : "sap.ui.core.Toolbar", multiple : false}
toolbar : {type : "sap.ui.core.Toolbar", multiple : false,
forwarding: {
idSuffix: "--Form",
aggregation: "toolbar"
}
}
},
associations: {

Expand Down Expand Up @@ -523,27 +528,16 @@ sap.ui.define([
SimpleForm.prototype.setToolbar = function(oToolbar) {

this._bChangedByMe = true;
var oForm = this.getAggregation("form");
oForm.setToolbar(oToolbar);

this.setAggregation("toolbar", oToolbar);
this._bChangedByMe = false;
return this;

};

SimpleForm.prototype.getToolbar = function() {

var oForm = this.getAggregation("form");
return oForm.getToolbar();

};

SimpleForm.prototype.destroyToolbar = function() {

this._bChangedByMe = true;
var oForm = this.getAggregation("form");
oForm.destroyToolbar();

this.destroyAggregation("toolbar");
this._bChangedByMe = false;
return this;

Expand Down Expand Up @@ -1957,7 +1951,7 @@ sap.ui.define([

if (!this._bChangedByMe) {
// check if content is still the same like in array
// maybe ca Control was destroyed or removed without using the SimpleForm API
// maybe a Control was destroyed or removed without using the SimpleForm API
// as invalidate is fired for every single object only one object can be changed
var aContent = _getFormContent(this.getAggregation("form"));
var i = 0;
Expand Down

0 comments on commit a8a8199

Please sign in to comment.