Thomas Buckley
Thomas Buckley

Reputation: 6056

Rerender dataTable/dataScroller and return to first paginated page of results

I have a question on a piece of functionailty I need to add to dataTable / dataScroller components.

I have the following code:

<a4j:outputPanel id="renderArea">
    <rich:dataTable id="mainDataTable">
        ......
        <rich:column>
            <h:commandButton value="Add" action="#{myBean.addItem}" reRender="myDataScroller, mainDataTable"/>
        </rich:column>
    </rich:dataTable>
</a4j:outputPanel>


<a4j:outputPanel id="PTScroll">
    <h:panelGrid>
        <rich:datascroller for="mainDataTable" id="myDataScroller" maxPages="20" renderIfSinglePage="false" />
    </h:panelGrid>
</a4j:outputPanel>

So when the user is on the second/third/etc paginated page of the table, and they add an item via the action="#{myBean.addItem}" action. I want the dataTable/dataScroller to reRender and return to the first page of my Table.

Is there a quick simple way to do this in my jsf code?

Thanks

Upvotes: 3

Views: 3426

Answers (1)

Adam
Adam

Reputation: 5070

rich:datascroller has a page attribute, it should work.

If page >= 1 then it's a page number to show

Upvotes: 1

Related Questions