[SOLVED] styleClass on p:column tag

UI Components for JSF
Post Reply
hrz
Posts: 6
Joined: 10 Mar 2010, 10:58

20 Apr 2010, 08:43

Hi,

Does styleClass attribute on p:column tag evaluate EL conditional?

Example :

Code: Select all

<p:column sortBy="#{myBean.total}" parser="string" styleClass="#{(myBean.total ge 0.71) ? 'greenbg' : 'yellowbg'}">
I tried but so far it won't work. It always giving me "yellowbg" value, might be because myBean didnt evaluated correctly (always evaluated as false).
I tried to evaluate #{(myBean.total ge 0.71) ? 'greenbg' : 'yellowbg'} on h:outputText, it shows me the correct value (EL evaluated successfully).

I'm using primefaces 2.0.1 (JSF 2.0) on Mojarra 2.0.2 (FCS b10) - Glassfish v3.

Thanks in advance.
Last edited by hrz on 05 May 2010, 06:25, edited 1 time in total.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

22 Apr 2010, 15:00

Yes, it should evaluate EL expressions for sure.

What happens when you use the same expression somewhere else? Same result?

hrz
Posts: 6
Joined: 10 Mar 2010, 10:58

26 Apr 2010, 04:28

I tried to evaluate on h:outputText inside the p:column tag, and it works well.

Could it be because the bean member i tried to access is part of the collection that iterated over the p:dataTable? Because i tried to access static member of the bean just for testing and found no problem.

Thank You.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

29 Apr 2010, 23:28

Yes, that seems to be the reason as column styleClass is evaluated only once not per each row iterator.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests