您好,我正在尝试将聚合绑定到 Table 控件上,但结果行与数据集中的最后一个结果重复。详细地说,该表包含正确数量的行和列,但每行重复相同的数据。
执行 OData 读取调用并将结果放入 JSON 模型并将该模型绑定到表上是可行的,但这似乎不必要地昂贵。
绑定部分
var filter = new Filter("itemID", sap.ui.model.FilterOperator.EQ, this.item.itemID);
this._template = this._template ? this._template : sap.ui.xmlfragment("InventoryListItem", this.getView().getController());
this.inventoryList.bindAggregation("items", {
path: "oDataModel>/InventoryUsages",
filters: [filter],
template: this._template,
parameters: {
select: 'inventoryID,memberID,fName,lName,condition,purchasedAt,price'
}
});
Run Code Online (Sandbox Code Playgroud)
模板:
<core:FragmentDefinition
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:l="sap.ui.layout">
<ColumnListItem>
<cells>
<Text text="{path: 'oDataModel>inventoryID'}" />
<Text text="{parts:[{path:'oDataModel>fName'}, {path:'oDataModel>lName'}], formatter:'.nameFormater'} " />
<Text text="{oDataModel>purchasedAt}" />
<RatingIndicator maxValue="5" class="sapUiSmallMarginBottom" value="{
path: 'oDataModel>condition', formatter: '.conditionFormat'}"
change="onRatingPress"/>
<Text text="{path:'oDataModel>price', formatter: '.priceFormatter'}" />
<Button text="Remove"
icon="sap-icon://delete"
press="onRowDelete"
class="appBtn"/>
</cells>
</ColumnListItem>
Run Code Online (Sandbox Code Playgroud)
该表显示正确的行数和列数,但数据错误。它将显示每行集合中的最后一个结果。当表格增长时,表格将显示集合中的下一个最后结果。有谁知道我该如何解决这个问题? …
sapui5 ×1