Sapui5 如何根据状态值更改sap.ui.table.table行的颜色?
我想根据状态值更改网格表(Sapui5 如何根据状态值更改sap.ui.table.table行的颜色?,sapui5,sap-fiori,Sapui5,Sap Fiori,我想根据状态值更改网格表(sap.ui.table.table)的行颜色。我遵循这个原则并尝试了一下,但没有成功 有人能提出如何实现这一目标的建议吗 以下是xml代码: CSS文件: tr[data mydata=“Success”]{ 背景:#ff3333!重要; } 有一些方法 第一: 在XML视图中 <core:FragmentDefinition xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.
sap.ui.table.table
)的行颜色。我遵循这个原则并尝试了一下,但没有成功
有人能提出如何实现这一目标的建议吗
以下是xml代码:
CSS文件:
tr[data mydata=“Success”]{
背景:#ff3333!重要;
}
有一些方法
- 第一:
<core:FragmentDefinition
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns:customData="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
xmlns="sap.m">
<!-- ... -->
<table:Column>
<Text text="Status"/>
<!-- ... -->
<customData>
<core:CustomData xmlns:core="sap.ui.core" key="background" value="FillBackgroundColor" writeToDom="true" />
</customData>
</Text>
<!-- ... -->
<!-- ... -->
<table:Column>
<Text text="Status"/>
<!-- ... -->
<customData>
<core:CustomData
key="style-class"
value="nameOfYourColor"
writeToDom="true"/>
</customData>
</Text>
<!-- ... -->
- 第二:
<core:FragmentDefinition
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns:customData="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
xmlns="sap.m">
<!-- ... -->
<table:Column>
<Text text="Status"/>
<!-- ... -->
<customData>
<core:CustomData xmlns:core="sap.ui.core" key="background" value="FillBackgroundColor" writeToDom="true" />
</customData>
</Text>
<!-- ... -->
<!-- ... -->
<table:Column>
<Text text="Status"/>
<!-- ... -->
<customData>
<core:CustomData
key="style-class"
value="nameOfYourColor"
writeToDom="true"/>
</customData>
</Text>
<!-- ... -->
我更喜欢第二个)这能回答你的问题吗?由于这个问题的标签是[sap fiori],我认为与fiori设计指南保持一致对应用程序特别重要。在这种情况下,请避免上述链接答案中提到的自定义CSS。@Hoffmann感谢您的回复。。。我试着像链接中提到的那样,但没能实现。对于(var i=0;i
[data-style-class=nameOfYourColor] {
background-color: #c9fcd5 !important
}