简体   繁体   中英

modify styleClass of a p:commandButton conditionally in primefaces

I would like to modify the style class of ap:commandButton in primefaces conditionally, like this:

 <p:commandButton  value="#{file.name}"  styleClass="#{file.statut == 0 ? 'normalClass' : 'strikeThroughClass'}">

It works OK for the normal

outputText 

but does not seem to work on the

 p:commandButton  

Could you give me a hand ?

I used

 <h:commandButton styleClass="#{dmFile.statut == 0 ? 'normalClass' : 'strikeThroughClass'}     ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"  value="#{dmFile.name}">
</h:commandButton>

And in css

.ui-button.strikeThroughClass{
 text-decoration:line-through!important;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM