【发布时间】:2019-10-11 03:33:07
【问题描述】:
我有一个用例,我想在FormElement 中添加两个sap.m.Input 控件。但是我有某些条件可以更改这两个Input 控件。正如我在许多示例中看到的,.bindAggregation 方法只返回一个控件。我可以让它返回控件数组吗?
var oInput1 = new sap.m.Input();
var oInput2 = new sap.m.Input();
var oInput3 = new sap.m.Input();
var oFormElement = new sap.ui.layout.form.FormElement();
oFormElement.bindAggregation("fields", "properties", function(sId, oContext){
var value = oContext.getProperty("value");
if (value > 5) {
return [oInput1, oInput3];
} else {
return [oInput1, oInput2];
}
});
我已经编写了这个示例,但它什么也没显示。如何返回.bindAggregation 中的控件数组。我试图在字段中使用HBox,但它有导致布局问题的风险。有人可以帮忙吗?
提前致谢。
【问题讨论】:
-
正如 @corshdi 提到的,您需要使用工厂功能。下面是工作示例Factory Function for sap.m.Table
标签: javascript forms sapui5 aggregation