【发布时间】:2020-08-31 17:52:51
【问题描述】:
我正在尝试选择用户检查的所有记录,但我不能。 使用代码:
var gettingInternalTable = this.byId("bpTable").getTable(),
gettingAllRows = gettingInternalTable.getRows();
我可以获取屏幕上显示的所有行,但我无法通过复选框进行过滤。 我正在使用 smartTable 来显示数据。
点击这是我的链接:
这是我的观点:
<mvc:View xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:smartTable="sap.ui.comp.smarttable"
controllerName="opensap.odataBasic.controller.App" height="100%">
<Page title="{i18n>appTitle}">
<content>
<smartTable:SmartTable id="bpTable" header="{i18n>UList}" editable="false"
showRowCount="true" enableAutoBinding="true"
showFullScreenButton="true" tableType="Table">
<smartTable:layoutData>
<FlexItemData growFactor="1" baseSize="0%"/>
</smartTable:layoutData>
<smartTable:customToolbar>
<OverflowToolbar width="100%" id="toolbar2">
<content>
<Button xmlns="sap.m" text="Button" id="button"
press=".reprocessSelectedRecords"/>
</content>
</OverflowToolbar>
</smartTable:customToolbar>
</smartTable:SmartTable>
</content>
</Page>
</mvc:View>
这是我的控制器:
onInit: function () {
this.getView().addStyleClass("sapUiSizeCompact");
var oConfig = this.getOwnerComponent().getModel("config");
var userName = oConfig.getProperty("/UserName");
var bpModel = this.getOwnerComponent().getModel("bpModel");
var oTable = this.getView().byId("bpTable");
//To-Do Bind Model to table
oTable.setModel(bpModel);
oTable.setEntitySet("OZPSTA_MON_ERROR");
oTable.setInitiallyVisibleFields("id", "codigo_atena", "hora", "data", "flag",
"tableName", "field", "erro", "operacao");
},
reprocessSelectedRecords: function (oEvent) {
var gettingInternalTable = this.byId("bpTable").getTable(),
gettingAllRows = gettingInternalTable.getRows();
gettingAllRows.map(function (item) {
// get the selected rows
});
}
【问题讨论】:
-
恕我直言,您不需要访问表格,由于双向绑定,您的模型中应该已经可以使用信息。 (虽然我从未使用过 SmartTable,所以我可能错了)
标签: sapui5