sapui5 - 如何使用bindAggregation ui5将列添加到控制器中的表
问题描述
I have created value help
我想要的是添加另一列数量 将它添加到列中不是问题,因为它是全部 JSON 但是将它放在行中有点问题 - 因为我从表中提取数据 - 产品 - 它们没有数量。我想通过邀请在这里创建这个关键是代码是oTable.bindAggregation的形式
onValueHelpRequested: function() {
var aCols = this.oColModel.getData().cols;
this._oValueHelpDialog = sap.ui.xmlfragment("Ztest.Ztest.view.ValueHelpDialogBasic", this);
this.getView().addDependent(this._oValueHelpDialog);
this._oValueHelpDialog.getTableAsync().then(function (oTable) {
oTable.setModel(window.orders);
oTable.setModel(this.oColModel, "columns");
if (oTable.bindRows) {
oTable.bindAggregation("rows", "/Items");
}
if (oTable.bindItems) {
oTable.bindAggregation("items", "/Items", function () {
return new ColumnListItem({
cells: aCols.map(function (column) {
return new Label({ text: "{" + column.template + "}" });
})
});
});
}
this._oValueHelpDialog.update();
}.bind(this));
this._oValueHelpDialog.setTokens(this._oMultiInput.getTokens());
this._oValueHelpDialog.open();
},
解决方案
您的表格仅包含带有标签的行,因为您ColumnListItem
的单元格是以这种方式创建的。如果您想添加其他内容,则需要调整您的工厂功能。例如:
return new ColumnListItem({
cells: aCols.map(function (column) {
if (<condition>) {
return new StepInput(...);
} else {
return new Label({ text: "{" + column.template + "}" });
}
})
});
推荐阅读
- java - java对象锁定和监视器创建如何在JVM内部发生
- python-3.x - 类播放器 - 动画停止第一帧
- python - 我如何检查python中的键位
- c# - 在 UWP Template10 App 中,后退按钮总是返回到起始页
- c++ - 如何擦除向量元素中没有特定字符的元素
- node.js - 使用 Telegram Bot API 检索受邀用户
- javascript - 由于 JavaScript 无休止的垃圾收集,IE 冻结
- c# - 是否可以在 C# 中创建非固定大小的数组?
- google-bigquery - 复制仅覆盖源表中的分区的分区 bigquery 表
- python - 使用 zip 命令从列表列表中获取所有列表的最后一个元素