如何突出显示 sap.ui.table.Table 中的整行 [英] How to highlight entire row in sap.ui.table.Table

查看:30
本文介绍了如何突出显示 sap.ui.table.Table 中的整行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在执行以下操作以突出显示表格中的整行:

this.byId("sampleTable").getRows()[i].addStyleClass("someClass");

.someClass{背景:#b0c4de !重要;}

结果:

它有效,但我从其他问题中了解到,不建议这样做并使用 oRow.addStyleClass,因为它不是公共方法.

非常感谢任何链接、建议或答案.

解决方案

设计不支持使用自定义颜色突出显示整行.同时,SAP 建议避免使用自定义 CSS:

<块引用>

SAP Fiori 启动板应用不应覆盖样式.
来自:https://openui5.hana.ondemand.com/entity/sap.ui.table.Table/sample/sap.ui.table.sample.RowHighlights

为行添加语义颜色:

<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:

SAP Fiori launchpad apps should not override styles. (source)

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:


From: https://openui5.hana.ondemand.com/entity/sap.ui.table.Table/sample/sap.ui.table.sample.RowHighlights

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 中的整行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆