Rerender dataTable / dataScroller and return to the first page paginated

I have a question about the part of the functionality that I need to add to the 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 a page with two pages / third / etc. tables, and they add an element through the action action = "# {myBean.addItem}". I want dataTable / dataScroller to overwrite and return to the first page of my table.

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

thank

+3
source share
1 answer

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

If page> = 1, then the page number to display

+1

All Articles