问题描述
我一直在执行以下操作以突出显示表格中的整行:
this.byId("sampleTable").getRows()[i].addStyleClass("someClass");
.someClass{背景:#b0c4de !重要;}
结果:
它有效,但我从其他问题中了解到,不建议这样做并使用 oRow.addStyleClass
,因为它不是公共方法.
非常感谢任何链接、建议或答案.
设计不支持使用自定义颜色突出显示整行.同时,SAP 建议避免使用自定义 CSS:
SAP Fiori 启动板应用不应覆盖样式.
为行添加语义颜色:
<RowSettings highlight="{= ${odataModel>foo} >50 ?'错误':空}"/></rowSettingsTemplate><!-- ... -->启用交替行颜色:
<!-- ... -->示例 https://jsbin.com/toxehec/edit?js,output
I have been doing the below to highlight an entire row in a table:
this.byId("sampleTable").getRows()[i].addStyleClass("someClass");
.someClass{
background: #b0c4de !important;
}
Result:
It works but I learnt from other questions that doing this way and using oRow.addStyleClass
is not recommended since it's not a public method.
Any links, recommendations or an answer are much appreciated.
解决方案 Highlighting the entire row with custom colors is not supported by design. At the same time, SAP recommends to avoid custom CSS:
UI5 instead provides row indication with semantic colors as well as alternate row colors which are all theme-dependent. In Quartz Light (Fiori 3 default theme) for example:
Adding semantic color to the row:
<Table xmlns="sap.ui.table">
<rowSettingsTemplate>
<RowSettings highlight="{= ${odataModel>foo} > 50 ? 'Error' : null}" />
</rowSettingsTemplate>
<columns> <!-- ... -->
Enabling alternate row colors:
<Table xmlns="sap.ui.table" alternateRowColors="true">
<!-- ... -->
Sample https://jsbin.com/toxehec/edit?js,output
这篇关于如何突出显示 sap.ui.table.Table 中的整行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
08-12 04:14