6 Replies Latest reply on Nov 9, 2011 10:56 AM by bmon

    Datagrid scrolling is not working in RF4

    bmon

      Hi, we are moving to RF4 and I am having problem with datagrid scrolling:

       

      Here is my page:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

      xmlns:h="http://java.sun.com/jsf/html"

      xmlns:f="http://java.sun.com/jsf/core"

      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:a4j="http://richfaces.org/a4j"

      xmlns:rich="http://richfaces.org/rich"

      xmlns:hx="http://www.ibm.com/jsf/html_extended"

      xmlns:p="http://primefaces.prime.com.tr/ui">

       

      <f:view>

      <h:head>
        <link rel="stylesheet" type="text/css" href="../theme/stylesheet.css"/>
        <script type="text/JavaScript" src="script/curvycorners.js"></script>

      <script language="JavaScript" type="text/javascript">
        </script>
      <style>

      </style>
      </h:head>
      <h:body>
      <h:form>

      <rich:tabPanel id="tabpanel" switchType="client">
            <rich:tab id="tab1" header="tab1">
                  tab1
            </rich:tab>
            <rich:tab id="tab2" header="tab2">
                  <rich:dataGrid value="#{news.news}" var="newsBean" id="newsGrid"
                     columns="1" elements="1" width="100%" border="0">
                     <rich:panel bodyClass="pbody">
                      <f:facet name="header">
                       <h:outputText value="News">
                       </h:outputText>
                      </f:facet> 
          
                     <h:panelGrid columns="1" id="newsPanel">
           
                       <h:commandLink value="#{newsBean.linkNews}">
                          <rich:componentControl target="popup" operation="show" />
                       </h:commandLink>
                          #{newsBean.shortNews}            
           
                     </h:panelGrid>
                </rich:panel>
                <f:facet name="footer">
                      <rich:dataScroller />
                </f:facet>
               </rich:dataGrid> 
            </rich:tab>
      </rich:tabPanel>
      </h:form>

      </h:body>
      </f:view>

      </html>

       

       

      When I click on a different page in the scroller I see javascript:void(0); in the left bottom corner of the screen and content of the 1st page is still displayed.

       

      P.S. switchtype="ajax" doesn't work either.

       

      Any suggestions what the problem could be?

       

      Thank you.

        • 1. Re: Datagrid scrolling is not working in RF4
          mp911de

          Hi Feliks,

          two things:

          1. take the datascroller out of your table and place it somewhere outside
          2. you need to specify the for-attribute and reRender of the rich:dataScroller. Put the id of the table you want to control in the for

           

          This would result in: <rich:dataScroller for="tab2"  reRender="tab2" />

          I would also suggest wrapping the table and the scroller within a a4j:outputPanel.

           

           

          Best regards,

          Mark

          • 2. Re: Datagrid scrolling is not working in RF4
            bmon

            Hi Mark.

             

            Thanks for he reply. I tried your suggestions - no luck. I simplified my code to that:

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

            <rich:tab header="tab2" id="tab2

            >

             

             

             

            <a4j:outputPanel>

             

             

                 <rich:dataTable id="dataTable" rows="1" value="#{news.news}" var="newsBean" >

             

             

                      <rich:column>

             

                

             

                           #{newsBean.linkNews}

             

             

                      </rich:column>

             

             

             

                 <rich:dataScroller for="dataTable"/>

             

             

             

            </a4j:outputPanel>

             

             

             

            </rich:tab>

             

             

             

             

            When I add rendered="dataTable" to the datascroller, it is not showing on page at all

                 </rich:dataTable

            • 3. Re: Datagrid scrolling is not working in RF4
              mp911de

              Hi Feliks,

              the second attribute is reRender not rendered :-)

               

              Best regards,

              Mark

              • 4. Re: Datagrid scrolling is not working in RF4
                mp911de

                And in RF4 only rerender (they changed the case).

                • 5. Re: Datagrid scrolling is not working in RF4
                  bmon

                  Hi Mark, sorry my typo. I tried rerender="dataTable" and still the same result - the scroller is showing correct number of pages, but the content is the same when I click on another page

                  • 6. Re: Datagrid scrolling is not working in RF4
                    bmon

                    I think I found the solution. For some reason I have to render dataScroller also. This code did the trick: render="dataTable dataScroller". But here is another problem - on a last page if number of enrties to display is less than rows=".." on a datatable, remaining rows are loaded with data from the first page. Any idea why is it happening?