如何突出显示 sap.ui.table.Table 中的整行
How to highlight entire row in sap.ui.table.Table
我一直在执行以下操作以突出显示 table 中的整行:
this.byId("sampleTable").getRows()[i].addStyleClass("someClass");
.someClass{
background: #b0c4de !important;
}
结果:
它有效,但我从其他问题中了解到,不推荐这样做并使用 oRow.addStyleClass
,因为它不是 public 方法。
非常感谢任何链接、建议或答案。
设计不支持使用自定义颜色突出显示整行。同时SAP建议避免自定义CSS:
SAP Fiori launchpad apps should not override styles. (source)
UI5 改为提供带有语义颜色的行指示以及所有 theme-dependent 的备用行颜色。以 Quartz Light(Fiori 3 默认主题)为例:
发件人:https://openui5.hana.ondemand.com/entity/sap.ui.table.Table/sample/sap.ui.table.sample.RowHighlights
向行添加语义颜色:
<Table xmlns="sap.ui.table">
<rowSettingsTemplate>
<RowSettings highlight="{= ${odataModel>foo} > 50 ? 'Error' : null}" />
</rowSettingsTemplate>
<columns> <!-- ... -->
启用交替行颜色:
<Table xmlns="sap.ui.table" alternateRowColors="true">
<!-- ... -->
也可以使用这些颜色 (source):
所以在这里突出显示:
<Table xmlns="sap.ui.table">
<rowSettingsTemplate>
<RowSettings highlight="{= ${odataModel>foo} > 50 ? 'Error' : null}" />
</rowSettingsTemplate>
<columns> <!-- ... -->
您还可以使用值 IndicationXX
,其中 XX
从 01
到 08
。
我一直在执行以下操作以突出显示 table 中的整行:
this.byId("sampleTable").getRows()[i].addStyleClass("someClass");
.someClass{
background: #b0c4de !important;
}
结果:
它有效,但我从其他问题中了解到,不推荐这样做并使用 oRow.addStyleClass
,因为它不是 public 方法。
非常感谢任何链接、建议或答案。
设计不支持使用自定义颜色突出显示整行。同时SAP建议避免自定义CSS:
SAP Fiori launchpad apps should not override styles. (source)
UI5 改为提供带有语义颜色的行指示以及所有 theme-dependent 的备用行颜色。以 Quartz Light(Fiori 3 默认主题)为例:
发件人:https://openui5.hana.ondemand.com/entity/sap.ui.table.Table/sample/sap.ui.table.sample.RowHighlights
向行添加语义颜色:
<Table xmlns="sap.ui.table">
<rowSettingsTemplate>
<RowSettings highlight="{= ${odataModel>foo} > 50 ? 'Error' : null}" />
</rowSettingsTemplate>
<columns> <!-- ... -->
启用交替行颜色:
<Table xmlns="sap.ui.table" alternateRowColors="true">
<!-- ... -->
也可以使用这些颜色 (source):
所以在这里突出显示:
<Table xmlns="sap.ui.table">
<rowSettingsTemplate>
<RowSettings highlight="{= ${odataModel>foo} > 50 ? 'Error' : null}" />
</rowSettingsTemplate>
<columns> <!-- ... -->
您还可以使用值 IndicationXX
,其中 XX
从 01
到 08
。