You need a css file, let's say default.css, that you need to include in the head. Then in this file, define a style class for your row. For the example you gave, you have two conditions in your EL, that can be combined as one using "or". I`m guessing what you meant is (quantity <= 10 or quantity > 50):
Code: Select all
<p:dataTable id="articleTable" value="#{articleCtr.listArticle}" var="article" rowKey="#{article.num_article}"
selection="#{articleCtr.selectedArticle}" selectionMode="single" rowStyleClass="#{(article.quantity le 10 or article.quantity gt 50) ? 'yes': null}">
and in your default.css, you define the "yes" style class:
Code: Select all
.yes {
background-color: red !important; //or whatever color you like.
}
Later edit:
For example If quantity< 10 row takes red else row takes green.
(you said nothing about >50 here)
For this case, you need another css class, let's say "no":
Code: Select all
<p:dataTable id="articleTable" value="#{articleCtr.listArticle}" var="article" rowKey="#{article.num_article}"
selection="#{articleCtr.selectedArticle}" selectionMode="single" rowStyleClass="#{(article.quantity lt 10) ? 'yes': 'no'}">
Code: Select all
.yes {
background-color: red !important; //or whatever color you like.
}
.no {
background-color: green !important; //or whatever color you like.
}