I build a control like this:
sap.ui.define([
"sap/m/VBox",
"sap/m/Label",
"sap/m/Input",
], function (VBox, Label, Input) {
"use strict";
return VBox.extend("my.special.Control", {
metadata : {
properties : {
},
events: {
},
},
init : function () {
var that = this;
if (VBox.prototype.init) {
VBox.prototype.init.call(this);
}
this.addItem(new Label({text : "label"}));
this.addItem(new Input({value : "value"}));
},
renderer : {},
});
});
During usage it looks like the control duplicates the elements (Label and Input). I assume the duplication will be done somehow inside the SAPUI5 framework.
An example with the problem you will find here: https://jsbin.com/fuxenezije/1/edit?html,console,output
My intention is to extend the control with some more complex functions but the posted example will show just the minimum idea of reusing the existing controls inside a new one.
Anyone an idea if I did something wrong here or could it be a bug in the UI5 framework. For me it looks like this happens in combination of FlexBox inside a Grid control.
If I provide the two controls outside like this
template : new my.own.Control({
items : [ new sap.m.Label({text:"l"}), new sap.m.Input()]
})
nothing will be duplicated.
https://jsbin.com/dilohacudu/1/edit?html,console,output
What could be wrong with my code?