views:

2004

answers:

5

Hello,

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

+1  A: 

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)

Bozho
I removed it, but no luck...
Markos Fragkakis
see your firefox javascript console for any js errors and give them here
Bozho
Thanks, see attached.
Markos Fragkakis
I have them surrounded by both <f:view> and <h:form>, in this order.
Markos Fragkakis
try removing parts of the code (some columns, the binding attribute, etc), and see when it will start working (i.e. it will stop giving the js error)
Bozho
A: 

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.

Markos Fragkakis
A: 

I have the same problem rich:dataScroller does not refresh rich:dataTable in JSF, but in my rows a does not have any links, but if I change rich:dataTable by h:dataTable working fine. this is my code

    <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"  >

                    <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"  />
                    </f:facet>
                </rich:dataTable>
        </h:form>
    </f:view>

Some one could help me! thanks

Israel Rz Mx
A: 

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

                <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>
Hema
A: 

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.

I have already answered the question.
Markos Fragkakis