Format word if it's in a datatable

1

Given my datatable:

Notice the word Atack . Is it possible to create a check that if this word is in the datatable it gets a different formatting? Ex: Make bold and the color is Blue.

    
asked by anonymous 10.06.2016 / 20:58

1 answer

1

I think you can create a style like this: .atack { background-image: none !important; color: blue !important; font-weight: bold; width: 100%!imporant; height: 100%!imporant; } And in the outputText that you want to modify puts the check: styleClass="#{valor.toLowerCase().indexOf('atack')!= -1 ? 'atack':''}" If you wanted to modify only the word atack , you could then create a method in beam and check if the value contains the word, it would not be a good practice to do this:
public String contemAtack(String val) { //remova os espaços entre < b e < f e < /font e < /b return val.replace("Atack", < b>< font color=#0080c0>Atack< /font>< /b>); }
And in the datatable would add the check in the desired columns: < h:outputText value="#{seuBeam.contemAtack(valor)}" escape="false" />

    
13.06.2016 / 20:57