1
votes

I have a rich:dataTable and a rich:dataScroller. When I click on the datascroller, my dataTable does not refresh automatically to show the correct page. If, however, I press the refresh button the dataTable shows the correct page.

What am I doing wrong?

Here is my code:

<rich:dataTable id="applicantsTable"
binding="#{applicantListManBean.applicantsDataTable}"
value="#{applicantListManBean.applicantsList}" var="applicant"
rows="10" width="650">

<h:column>
    <f:facet name="header">
        <h:outputText value="Name" />
    </f:facet>
    <h:outputText value="#{applicant.name}" />
</h:column>

<h:column>
    <f:facet name="header">
        <h:outputText value="Email" />
    </f:facet>
    <h:outputText value="#{applicant.email}" />
</h:column>

<h:column>

    <f:facet name="header">
        <h:outputText value="Action" />
    </f:facet>

    <h:commandLink action="#{applicantListManBean.showApplicantProducts}"
        rendered="true">
        <h:graphicImage value="/images/icons/view.png" width="15" height="15"
            alt="view" />
        <f:setPropertyActionListener
            target="#{applicantListManBean.tempApplicant}" value="#{applicant}" />
    </h:commandLink>

    <h:commandLink action="#{applicantListManBean.deleteApplicant}"
        rendered="true">
        <h:graphicImage value="/images/icons/delete.png" width="15"
            height="15" alt="view" />
        <f:setPropertyActionListener
            target="#{applicantListManBean.tempApplicant}" value="#{applicant}" />
    </h:commandLink>

</h:column>
</rich:dataTable>

<rich:datascroller id="applicantsScroller" for="applicantsTable"
reRender="sc1" maxPages="7" page="#{applicantListManBean.scrollerPage}" />

UPDATE: Javascript error attached: alt text

1: http://imgur.com/132fL.png

5

5 Answers

3
votes

Remove reRender="sc1". You have copy-pasted this from the RichFaces demo, but you have removed the "sc1" component, so perhaps a javascript error occurs that prevents the table from refreshing.

Also make sure you have your dataTable and datascroller surrounded by <h:form>..</h:form> (both in one form)

1
votes

The problem is the h:commandLink. It somehow creates problems for the rich:datatable. Use a4j:commandLink or s:link (if you use Jboss Seam) instead.

1
votes

You may want to consider using t:saveState tag or putting the handler in session scope. The reason this is probably happening is because you have your handler in request scope and since the commandLink is another request, it cannot find the original handler instance to post back to. By simply having this saveState in here, mine started working.

Just a thought.

0
votes

Put id for rich:datatable and reRender in rich:datascroller to table as shown below. This works for me:

<f:view>
    <a4j:keepAlive beanName="datosCtrlBean" ajaxOnly="true"/>
    <h:form>
        <rich:dataTable reRender="sc2"  width="300" id="carList" rows="10" columnClasses="col"
                            value="#{datosCtrlBean.datos}" var="category" id="myTable" >

                <f:facet name="header">
                    <rich:columnGroup>
                        <h:column>
                            <h:outputText styleClass="headerText" value="Make" />
                        </h:column>
                    </rich:columnGroup>
                </f:facet>
                <h:column>
                    <h:outputText value="#{category}" />
                </h:column>
                <f:facet name="footer">
                <rich:datascroller align="left" for="carList" id="sc2"  ajaxSingle="true" reRender="myTable" limitToList="myTable"/>
                </f:facet>
            </rich:dataTable>
    </h:form>
</f:view>
0
votes

is wrong..

try:

    <rich:dataTable width="300" id="carList" rows="10" columnClasses="col"
                        value="#{datosCtrlBean.datos}" var="category" >


            <rich:datascroller align="left" for="carList" id="sc2"  ajaxSingle="true" reRender="carList" limitToList="carList"/>