Best way to make an expandable / resettable subTable with rich: dataTable

I 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 create an expandable / prefab partViev for each row of the table.

The only thing I can think of is something like this (adapted from the docs.jboss.com documentation):

<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 think something like this will work. The problem is that I either have to add getDetailOpened and setDetailOpened to the objects being used, or wrap each object in a different object that provides these two methods.

Does anyone know a better way or how this should be done?

0


source to share


1 answer


I've often added methods to my beans (or wrapper beans) that contain these properties as a way to work with JSF. It's not pretty, but it works.



The only other option I can think of right now is to use a JavaScript function to toggle the view state of the details. This wouldn't be ideal for a number of reasons, but it would save you the hassle of keeping the back end.

+1


source







All Articles