Change group style

Community Driven Extensions Project
Post Reply
BeanHaas
Posts: 2
Joined: 31 Mar 2015, 16:06

31 Mar 2015, 16:27

Hi,

I have a timeline with the group "Rooms" and I need to change the background color of each "Room" depending on the % of ocupation.

Room 1 - 40% (background-color: yellow)
Room 2 - 85% (background-color: red)
Room 3 - 10% (background-color: green)

Is there a way to do it?

Thanks in advance.

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

05 Apr 2015, 12:20

What is the problem? You can use

Code: Select all

    <f:facet name="group">  
        <h:panelGroup style="background-color: #{room.color}">  
             #{room.name}
        <h:panelGroup> 
    </f:facet>
You model class Room should provide a method getColor() which returns a color as String depending on % of ocupation.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

BeanHaas
Posts: 2
Joined: 31 Mar 2015, 16:06

09 Apr 2015, 22:09

Thank you Oleg!

I wasn't using <h:panelGroup>.
I've tried changing the style (div.timeline-groups-text) but somehow it wasn't working well.

tony.herstell
Posts: 214
Joined: 29 Nov 2011, 00:40

25 May 2021, 02:48

I am struggling to get this going under PF 10.

Code: Select all

 <f:facet name="group">
            <h:panelGroup style="background-color: red !important" styleClass="#{xxxController.getGroupStyle(group)}" >
            		<h:outputText value="#{group}"/>
       		</h:panelGroup>
</f:facet>
Has anything changed?
PF12+, Quarkus 3.2+ (CDI, JPA etc.), JSF Bridge (MyFaces 4.0.1)
Dont forget the classifier:

Code: Select all

   ...primefaces
  <classifier>jakarta</classifier>
     ... theme
  <classifier>jakarta</classifier>

tony.herstell
Posts: 214
Joined: 29 Nov 2011, 00:40

25 May 2021, 02:54

Prime Icons also do not show up when used inside the Timeline (groups or the text area)

X<i class="pi pi-file"></i>X

the "X's show up; but not the prime icon

elsewhere on the page I am using prime icons and they show up...
PF12+, Quarkus 3.2+ (CDI, JPA etc.), JSF Bridge (MyFaces 4.0.1)
Dont forget the classifier:

Code: Select all

   ...primefaces
  <classifier>jakarta</classifier>
     ... theme
  <classifier>jakarta</classifier>

tony.herstell
Posts: 214
Joined: 29 Nov 2011, 00:40

25 May 2021, 02:58

I noticed this is "extensions"... but I am using the Timeline supplied in PF10.
Just saying.
PF12+, Quarkus 3.2+ (CDI, JPA etc.), JSF Bridge (MyFaces 4.0.1)
Dont forget the classifier:

Code: Select all

   ...primefaces
  <classifier>jakarta</classifier>
     ... theme
  <classifier>jakarta</classifier>

tony.herstell
Posts: 214
Joined: 29 Nov 2011, 00:40

25 May 2021, 03:01

PF12+, Quarkus 3.2+ (CDI, JPA etc.), JSF Bridge (MyFaces 4.0.1)
Dont forget the classifier:

Code: Select all

   ...primefaces
  <classifier>jakarta</classifier>
     ... theme
  <classifier>jakarta</classifier>

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

03 Jun 2021, 18:31

Yep I had to fix that cause they turned XSS protection on. Its fixed in 10.0.2.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests