newuser
newuser

Reputation: 8466

rich:dataScroller index refers previous dataTable scroller index inside a4j:repeat

I am using rich:dataTable inside the a4j:repeat. Every time the dataTable Scroller refer the index from the previous dataTable scroller index value. So the current dataTable having values but it displays empty table.

Because of,

previous dataTable list size is 200. previous dataTable scroller index is 7

Current DataTable list size is 5.

<a4j:repeat value="#{Bean.outerTOList}" var="sampleValue">

        <rich:dataTable id="dataTable" 
                        var="innerTo"
                        rows="5"
                        value="#{sampleValue.sampleInnerTOList}" >
            <f:facet name="header">
                <rich:column>
                    <h:outputText value="Header"/>
                </rich:column>
            </f:facet>


            <rich:column>
                <h:outputText value="#{innerTo.name}"/>
            </rich:column>


            <f:facet name="footer">
                <rich:datascroller id="dataTableScrollerId" 
                                   ajaxSingle="false" maxPages="3"                                                                       
                                   page="1">
                </rich:datascroller>
            </f:facet>

        </rich:dataTable>
    </a4j:repeat>

Upvotes: 0

Views: 527

Answers (1)

noone
noone

Reputation: 19776

I think you have to change the <ui:repeat> to a (JSTL) <c:forEach> (see http://www.crazysquirrel.com/computing/java/jsp/jstl-forEach.jspx) because it has another lifecycle and your implementation using ui:repeat won't work in this scenario.

After doing so you probably also need some kind of "discriminator" for your IDs, because you cannot name all table components the same. You would have to use something like id="datatable0",... id="datatable1" and so on. You can use c:forEach's varStatus="status"property to do so. It has a property which you can use as the counter: #{status.index}

Upvotes: 1

Related Questions