html - SAPUI5 响应式表多选集选定记录
问题描述
我有一个具有多选模式的 SAPUI5 响应表。而且我需要在将数据加载到表时显示选定的记录。找不到在响应表中设置选定记录的方法。
<Table id="idProductsTable"
inset="false"
mode="MultiSelect"
alternateRowColors="true"
items="{
path: '/ProductCollection',
sorter: {
path: 'Name'
}
}">
<headerToolbar>
<OverflowToolbar>
<Title text="Products" level="H2"/>
<ToolbarSpacer/>
<Label text="Multi selection modes" labelFor="idComboBoxSuccess"></Label>
<ComboBox id="idComboBoxSuccess" selectedKey="Default" selectionChange=".onSelectionChange">
<core:Item text="Default" key="Default"></core:Item>
<core:Item text="ClearAll" key="ClearAll"></core:Item>
</ComboBox>
</OverflowToolbar>
</headerToolbar>
<columns>
<Column width="12em">
<Text text="Product" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="Supplier" />
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="End">
<Text text="Dimensions" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<ObjectIdentifier
title="{Name}"
text="{ProductId}"/>
<Text
text="{SupplierName}" />
<Text
text="{Width} x {Depth} x {Height} {DimUnit}" />
</cells>
</ColumnListItem>
</items>
</Table>
有没有办法在表格中设置选定的行并显示选定的记录。
解决方案
您可以使用selected
ColumnListItem 中的属性。
<ColumnListItem selected="{YourSelectedBoolean}">
<cells>
<ObjectIdentifier title="{Name}" text="{ProductId}"/>
<Text text="{SupplierName}" />
<Text text="{Width} x {Depth} x {Height} {DimUnit}" />
</cells>
</ColumnListItem>
推荐阅读
- javascript - 从 Angular 组件调用 AngularJS 指令方法 - upgradeComponent
- java - 如何将 mailR 中的 send.mail 带到 Mac Mini 上工作?
- react-native - 如果更新后,React Native Maps 不会以用户位置为中心
- c++ - 如果满足条件,则在可变参数模板参数包中调用可变参数模板函子
- javascript - 使用 cron 重新连接 bd 重新启动 - 节点
- c++ - 创建动态可变参数列表并将其传递给 std::function
- rundeck - rundeck :如何更正rundeck的配置以通过浏览器访问
- selenium - FindElements() 的隐式等待
- spring-boot - 在 Spring Boot 中从 Web 服务获取数据库密码
- javascript - 从可读流显示 PDF -> 无法加载 PDF 文档