1
votes

Version :

RichFaces 4.3.5

Apache MyFaces 2.1

Issue :

We are migrating from JSF 1.2 to JSF2. As shown in below code , rich:dataTable uses columnClasses attribute to style columns. The issue is columnClasses are not getting applied repetitively . That is , if there are four columns , we need to specify four columnClasses attribute values separately like columnClasses=column1,column1,column1,column1.

This is really annoying since I need to use same columnClass for all columns. I tried using spaces for columnClasses like columnClasses=column1 column1 , but no success.

Has anybody faces same issue ? Is there any workaround for this apart from specifying columnClasses manually ?

Code :

<rich:dataTable id="userList" styleClass="style1" headerClass="header1" rowClasses="table_evenRow,table_oddRow"
    columnClasses="column1,column1,column1,column1" value="#{bean.userList}" var="user">
                            <f:facet name="header">
                                <rich:columnGroup columnClasses="table_header">
                                    <h:column>
                                        <h:outputText value="First Name" />
                                    </h:column>
                                    <h:column>
                                        <h:outputText value="Last Name" />
                                    </h:column>
                                    <h:column>
                                        <h:outputText value="Email" />
                                    </h:column>
                                    <h:column>
                                        <h:outputText value="Phone" />
                                    </h:column>
                                </rich:columnGroup>
                            </f:facet>
                            <h:column>
                                <h:outputText value="#{user.firstName}" />
                            </h:column>
                            <h:column>
                                <h:outputText value="#{user.lastName}" />
                            </h:column>
                            <h:column>
                                <h:outputText value="#{user.email}" />
                            </h:column>
                            <h:column>
                                <h:outputText value="#{user.phoneNum}" />
                            </h:column>
</rich:dataTable>
1
Hm, that's a bug. The attribute doesn't work as described.Makhiel
Your problem somewhere else. I very often use it and it works fine. For example columnClasses=", , , , rightalign, rightalign, rightalign". Check your CSS.Vasil Lukach
@VasilLukach : Is RichFaces version same as 4.3.5 ?Atul
Yes, RichFaces version is exact 4.3.5Vasil Lukach

1 Answers

1
votes

I had the same issue and as Vasil Lukach mentioned in a comment, columnClasses="right,left,"... only adds a css class to the td elements in the dom-tree. e.g.:

<td id="form:table:0:j_idt36" class="rf-dt-c right">2</td>

In order to have an effect some css is required:

.left {
    text-align: left;
}

.right {
    text-align: right;
}