如何更改表(SAPUI5)中行的颜色? [英] How to change the color of row in table (SAPUI5)?
问题描述
我有一个表,其中的数据来自后端.根据特定条件(来自后端(网关服务)的数据),如果该条件为true,则该特定行将具有不同的颜色,并将在整个行上具有链接.如果条件为假,那么它将是正常行.
I have a table in which data is coming from back end. Based on particular condition(data coming from back end (gateway service)), if that condition is true then that particular row will have different color and will have a link on full row. And if condition is false then it will be a normal row.
那么如何实现呢?
推荐答案
现在支持行的语义颜色,可以通过使用属性highlight
Semantic colors for rows are now supported which can be leveraged by using the property highlight
-
在
ColumnListItem
使用sap.m.Table
(自1.44开始)时:
on
ColumnListItem
when usingsap.m.Table
(since 1.44):
<ColumnListItem
highlight="{= ${odataModel>foo} > 50 ? 'Error' : 'None'}"
> ...
在 RowSettings
上的sap.ui.table.Table
(自1.48开始)时:
on RowSettings
when using sap.ui.table.Table
(since 1.48):
<Table>
<rowSettingsTemplate>
<RowSettings highlight="{= ${odataModel>foo} > 50 ? 'Error' : 'None'}"
</rowSettingsTemplate>
<columns> ...
- Demo Kit sample Row Highlights
- Sample with indication colors, available since 1.62: https://jsbin.com/toxehec/edit?html,js,output
这篇关于如何更改表(SAPUI5)中行的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!