1 Reply Latest reply on Jun 3, 2011 8:52 AM by nimoh

    rich:datascroller out of sync with rich:extendedDataTable

    blackjet

      Hi,

       

      I'm struggling with thedatascroller/extendedDataTable combination, if anyone can point me in the rightdirection it would be very much appreicated!

       

      My application uses anextenedDataTable combined with a datascroller to allow users to searchthrough a list of Service Request objects (this "Service Request"object is just and abstract business concept).

       

      I am using the page attributeof the datascroller to persist the current page in the results set on the usersession. This means that while viewing the Service Requests in theextendedDataTable the user can click on a particular Service Request, navigateaway from the page with the extendedDataTable and view the details of theService Request they have clicked on; then navigate back to the table andstill be on the same page.

       

      This however is not thecase, the dataScroller will rememberwhich page it was at, but the extenededDataTable always reverts to the first page (eventhough the dataScroller is showing page 2 or 3 or 7 or whatever).


      Below is an extract of the dataScroller and the dataTable, many thanks in advance for any help that is offered!

       

      ~Drew

       

      {code:xml}

      <rich:extendedDataTable rendered="#{homeScreenBean.searchResultsHtmlTabPanel.selectedTab == preference.homeScreenPreferenceStringId}"

                                                  tableState="#{preference.resultsTableLayout}"

                                                  width="100%" sortMode="single" style="overflow: auto;"

                                                        id="searchResultsTable#{preference.homeScreenPreferenceStringId}"

                                                        height="685px"

                                                        value="#{homeScreenBean.requestSummaryList}"

                                                        rowKeyVar="currentRow" var="req" rows="25"

                                                        onRowMouseOver="this.style.backgroundColor='#F1F1F1'"

                                                        onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">

       

                                                        <f:facet name="header" id="columnGroupHeaderFacet">

                                                                  <rich:columnGroup id="columnGroupRequestForService">

                                                                            <rich:column colspan="6" id="columnScrollerTableNew">

                                                                                      <rich:datascroller align="left"

                                                                                                         page='#{preference.pageNumber}'

                                                                                                               maxPages="10" id="scrollerTableNew"

                                                                                                               style="{width:820px;}"

                                                                                                               for="searchResultsTable#{preference.homeScreenPreferenceStringId}"/>

                                                                            </rich:column>

       

                                                                            <rich:column colspan="26" style="text-align:left;" id="columnResetFilterButton">

                                                                                      <a4j:commandButton id="resetFilterButton" value="Reset"

                                                                                                action="#{userSessionBean.resetRequestFilters}"

                                                                                                styleClass="button" reRender="searchResultsTable#{preference.homeScreenPreferenceStringId}" />

                                                                                      <rich:spacer width="5" id="spacer3"/>

       

                                                                                      <a4j:commandButton id="filterButton" value="Filter" action='#{preference.resetPaging}'

                                                                                                styleClass="button, defaultButton, button"

                                                                                                reRender="searchResultsTable#{preference.homeScreenPreferenceStringId}" />

                                                                                      <rich:spacer width="60" id="spacer4"/>

       

                                                                                      <h:commandButton id="commandButtonGenerate"

                                          action="#{homeScreenBean.createExcelReport}"

                                          styleClass="button"

                                          value="Export" />

                                      <rich:spacer width="5" id="spacer5"/>

       

                                      <h:commandButton id="commandButtonGenerateAllColumns"

                                          action="#{homeScreenBean.createExcelReportWithAllColumns}"

                                          styleClass="button"

                                          value="Export All" />

                                      <rich:spacer width="5" id="spacer0" />

                                                                            </rich:column>

       

       

                                                                  </rich:columnGroup>

                                                        </f:facet>

                          <rich:column sortable="true"

                              width="25px" label="Notification" id="columnNotification" styleClass="#{req.styleForRequest}">

                              <f:facet name="header">

                                  <h:outputText value="" id="outputTextNotification" />

                              </f:facet>

                              <h:graphicImage id="buildingDeleteNotification" title="Building Deleted"

                               url="/images/icon-warning.png"

                               rendered="#{req.boolBuildingDeleted}">

                              </h:graphicImage>

                              <h:graphicImage id="policyCancNotification"  title="Policy Cancelled"

                               url="/images/icon-exclamation.png"

                               rendered="#{req.boolPolicyCancelation}">

                              </h:graphicImage> 

                              <h:graphicImage id="policyNotRenewedNotification" title="Policy Not Renewed"

                               url="/images/icon-exclamation.png"

                               rendered="#{req.boolPolicyNotRenewed}">

                              </h:graphicImage>

                              <h:graphicImage id="prospectSoldNotification" title="Prospect Sold"

                               url="/images/icon-tick.png"

                               rendered="#{req.boolProspectSold}"

                               style="cursor:hand;">

                               <a4j:support event="onclick" ajaxSingle="true" action="#{homeScreenBean.updateNotification}"

                                  reRender="searchResultsTable#{preference.homeScreenPreferenceStringId}" onsubmit="if(!confirm('Are you sure you want to clear the Notification?')){return false;}" id="supportDeleteLink">

                                 <f:setPropertyActionListener

                                      target="#{homeScreenBean.selectedRequestSummary}"

                                      value="#{req}" />                           

                              </a4j:support>

                              </h:graphicImage>                                             

                          </rich:column>

       

                          <!-- Request Number -->

                          <rich:column sortOrder="#{preference.requestNumberSearchCriteria.currentValue}"

                              sortable="true" sortBy="#{req.requestID}" styleClass="#{req.styleForRequest}"

                              filterExpression='#{empty userSessionBean.filterRequestId or userSessionBean.filterRequestId == req.requestID}'

                              rendered="#{preference.requestNumberSearchCriteria.displayInResults}"

                              width="64px" id="columnFilterRequest"

                              label='#{refDataLookupBean["SEARCH_COLUMN"]["REQNUM"]}' >

                              <f:facet name="header">FilterRequestId

                          <h:outputText value='#{refDataLookupBean["SEARCH_COLUMN"]["REQNUM"]}'

                                      id="outputTextFilterRequest" />

                              </f:facet>

                              <f:facet name="filter">

                                  <h:inputText value="#{userSessionBean.filterRequestId}"

                                      id="filterRequestIDInput" maxlength="9"

                                      label="Request ID Filter" />

                              </f:facet>

                              <h:commandLink action="#{requestForServiceBean.viewRequest}"

                                  styleClass="cmdLink" id="commandLinkRequestIDFilter">

                                  <f:setPropertyActionListener

                                      target="#{userSessionBean.currentRequestID}"

                                      value="#{req.requestID}" />

                                  <f:setPropertyActionListener

                                      target="#{createRequestForServiceBean.editMode}" value="true" />

                                  <f:setPropertyActionListener

                                      target="#{userSessionBean.requestContactSet}" value="#{null}" />

                                  <h:outputText value="#{req.requestID}"

                                      id="outputTextRequestIDFilter" />

                              </h:commandLink>

                          </rich:column>

       

                          <!-- Account Name -->

                          <rich:column sortOrder="#{preference.accountNameSearchCriteria.currentValue}"

                              sortable="true" sortBy="#{req.acctNme}" styleClass="#{req.styleForRequest}"

                              filterExpression='#{fn:containsIgnoreCase(req.acctNme, userSessionBean.filterAccount)}'

                              rendered="#{preference.accountNameSearchCriteria.displayInResults}"

                              width="102px" id="columnAccount"

                              label='#{refDataLookupBean["SEARCH_COLUMN"]["ACCTNM"]}'

                              >

                              <f:facet name="header">

                                  <h:outputText value='#{refDataLookupBean["SEARCH_COLUMN"]["ACCTNM"]}' id="outputTextAccount" />

                              </f:facet>

                              <f:facet name="filter">

                                  <h:inputText value="#{userSessionBean.filterAccount}"

                                      id="filterAccountInput" label="Account Filter" />

                              </f:facet>

                              <h:commandLink action="#{requestForServiceBean.viewSurveyGroups}"

                                  styleClass="cmdLink" id="commandLinkAccount">

                                  <f:setPropertyActionListener

                                      target="#{userSessionBean.currentRequestID}"

                                      value="#{req.requestID}" />

                                  <f:setPropertyActionListener

                                      target="#{createRequestForServiceBean.editMode}" value="true" />

                                  <f:setPropertyActionListener

                                      target="#{userSessionBean.requestContactSet}" value="#{null}" />

                                  <h:outputText value="#{req.acctNme}" title="#{req.acctNme}"

                                      id="outputTextCommandLinkAccount" />

                              </h:commandLink>

                          </rich:column>

       

                          <!-- REMAINING COLUMNS OMITTED FROM EXATRACT AS SURPERFLUOUS -->

       

      </rich:extendedDataTable>

       

      {code}


        • 1. Re: rich:datascroller out of sync with rich:extendedDataTable
          nimoh

          I am having the same problem.  My current workaround is to take a note of the currently viewed page in my session bean when the user takes a particular action leaving my page, then upon return to my page, the table is initially rendered hidden on page one, and if it is detected that a page other than page 1 was noted in the backing bean, a call is made to the datascroller component on the client side switchToPage method, then after all that the table is unhidden.

           

          Obviously this is a horrible workaround since the table is loaded twice, but at least it is working.  I would really like to hear about a better solution though.