Programmatically style panel component in dataGrid

UI Components for JSF
Post Reply
User avatar
MISS_DUKE
Posts: 273
Joined: 08 Aug 2010, 05:52

08 Sep 2010, 07:22

I have a dataGrid component and every grid contains a panel component, thus there are many panels in a page.

Every panel contains data of either a female or a male.

I like female panel has pink title bar and male panel has gray title bar.

How can I achieve this?

(I know I can use ui-panel-titlebar CSS class to style all panels with the same style, but my requirement is female panels should be pink and male panels should be gray)
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)

jaideralba
Posts: 51
Joined: 06 Sep 2010, 23:01
Location: São Paulo - Brazil

08 Sep 2010, 20:10

Hi miss_duke,

I don't know what css properties of the datagrid can be changed, but there is the styleClass of the datagrid that you could try something like this:

<p:dataGrid styleClass="#{yourBean.male ? 'maleCssClass' : 'femaleCssClass' }" >
</p:dataGrid>

I hope this help you.
Mojarra 2.0.2 (FCS b10)
GlassFish 3.0.1
PrimeFaces 2.2.1


User avatar
MISS_DUKE
Posts: 273
Joined: 08 Aug 2010, 05:52

09 Sep 2010, 03:51

The above replies really showed me the way to achieve my goal. Thanks very much.
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)

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

09 Sep 2010, 11:13

Glad to hear.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 38 guests