views:

2142

answers:

1

I've recently ported an application from JSF 1.1 to JSF 1.2. In the process we removed tomahawk and decided to use rich instead.

Now I need a way to make an expandable/collapsible detailViev for each row in the table.

The only thing I can think of is something along these lines (adapted from documentation at docs.jboss.com):

<rich:dataTable value="#{capitalsBean.capitals}" var="capitals">
    <rich:column>
        ...
    </rich:column>
    <rich:subTable value="#{capitals.details}" var="detail" ajaxKeys="#{bean.ajaxSet}" binding="#{bean.subtable}" id="subtable" rendered="detail.detailOpened">
        <rich:column>
            ...
        </rich:column>
    </rich:subTable>
</rich:dataTable>

I guess something like that would work. The problem is that I either have to add a getDetailOpened and a setDetailOpened to the objects I use, or wrap each object in another object that provides those two methods.

Anybody knows a better way, or how it is supposed to be done?

A: 

I've often added methods to my beans (or wrapper beans) which contain those properties as a way of working around JSF. It's not pretty but it works.

The only other option I can think of at the moment is to use a JavaScript function to toggle the state of the details view. That wouldn't be ideal for a number of reasons but it would save you having to keep state server-side.

Phill Sacre