Adam
Adam

Reputation: 3795

How to use Richfaces skinning on standard table?

From my understanding at the Richfaces demo page and docs, I should be able to skin standard HTML elements.

This feature provides styling for standard HTML form elements in order to be highly compilant with RichFaces common look'n'feel.

I may be a little burnt out with RF today, but I don't see how to get skinning on regular elements. For example if I wanted a hand made table to match the fancy Richfaces tables I would have thought something like this would work:

<table class="rich-table">
        <tr class="rich-tr">
        <a4j:repeat value="#{myBean.elements}" var="e">
            <th class="rich-th" >
                                   <h:outputText value="#{e.text}" />
                            </th>
                    </a4j:repeat>
            </tr>
    </table>

Other elements I've tried to skin haven't been working either, so I feel I am going at this the wrong way. The ultimate goal is to have standard HTML elements blend in and still allow the skins to be swapped from say blueSky to emeraldGreen w/o changing specific elements.

Upvotes: 0

Views: 1460

Answers (2)

hegemondev
hegemondev

Reputation: 21

There problem is - richFaces doesn't come with a "static table" tag, and does not provide automatic skinning of tables, because of "blablabla" (some lame excuse ;) ). And manual skinning is awful.

The solution: use rich:dataTable, providing some dummy value (rich:dataTable value="DummyStaticValue") and use rich:columnGroup together with rich:column.

Your combination will only be rendered once (because of the dummyValue being just a string), and you can get any table structure you want.

<rich:dataTable width="100%" value="DummyStaticValue">
    <f:facet name="header">
        <h:outputText value="myHeader" />
    </f:facet>
    <rich:columnGroup>
        <rich:column>
            <h:outputText value="myValue1" />
        </rich:column>
        <rich:column>
            <h:outputText value="myValue2" />
        </rich:column>
    </rich:columnGroup>
    <rich:columnGroup>
        <rich:column>
            <h:outputText value="myValue3" />
        </rich:column>
        <rich:column>
            <h:outputText value="myValue4" />
        </rich:column>
    </rich:columnGroup>

Upvotes: 2

Max Katz
Max Katz

Reputation: 1582

Try this. Add this context parameter: org.richfaces.CONTROL_SKINNING to web.xml and set it to 'enable'. I'm not 100% sure it will skin a table tag. If not, you can use #{richSkin.any_param_name} to skin the table manually.

Upvotes: 1

Related Questions