2 Replies Latest reply on Jan 6, 2012 4:29 AM by Dale Ellis

    Struggling implementing ExtendedDataModel and my web service

    Dale Ellis Newbie

      Hi all,

       

      I have a little application that pulls down some data via a web service. Up until now I have not implemented the data model so just cached all the returned results but I have now enhanced the web service to do pagination, so I thought the easiest part was done but I have spent 2 days not trying to get it working and something is not right. I have been using documentaion from Practical Richfaces 2nd edition and the online example but my scenrio is slightly different and I'm not sure what the issue is.

       

      The main difference from the example I have read is that I have a config driven set of search fields and a search button to load the table. It seems as through the way I make a ajax call is not reloading the model? or something like that as what happens is that when I press search, in the logs I see what I expect to happen, teh data is retreived and data cached but nothing is displayed in the table, although sometimes when I hit a certain combintion, like search then search, then do a sort then data is returned, just baffled at teh moment and would really appriecated some help in understanding where I'm going wrong

       

      Code

       

      caseSearch.xhtml

       

          <rich:collapsiblePanel id="criteriaCollapsePanel" header="${msg['casesearchpage.criteriaheader']}" switchType="client">

          <h:form id="searchForm">

              <h:panelGrid id="searchFieldContainer" style="${caseBean.searchFieldConfig.style}" columns="${caseBean.searchFieldConfig.columns}">

                  <ui:include src="includes/grids.xhtml">

                      <ui:param name="grids" value="${caseBean.searchFieldConfig.grids}"/>

                  </ui:include>

              </h:panelGrid>

       

       

              <br/>

              <a4j:commandButton id="searchSubmit" value="${caseBean.searchFieldConfig.button.label}" action="${caseBean.search}"

              style="${caseBean.searchFieldConfig.button.style}" immediate="true"

              onbegin="this.disabled=true"

              oncomplete="#{rich:element('searchSubmit')}.disabled=false; hideIfResultsReturned();"

              render="caseResultsContainer"/>

       

       

       

              <a4j:status id="status">

                  <f:facet name="start">

                      <h:graphicImage value="images/loading.gif" alt="Search for cases..." style="margin-left: 10px;" />

                  </f:facet>

              </a4j:status>

          </h:form>

          </rich:collapsiblePanel>

       

      ...

      ...

       

          <h:panelGroup id="caseResultsContainer">

              <h:form id="caseSearchResultsForm">

       

       

                   <h:outputLabel escape="false" value="#{msg['casesearchpage.searchresults.headding']}"

                                  rendered="#{not empty msg['casesearchpage.searchresults.headding'] and caseBean.hasResults}" style="margin-top:10px; display:block;" />

                   <br/>

       

       

                   <rich:dataTable id="caseResults" value="${caseBean.tableModel}" var="row"

                      rows="${layoutBean.caseSearchTableConfig.rows}" style="${layoutBean.caseSearchTableConfig.style};"

                      rowClasses="odd, even" sortMode="single">

       

       

                      <c:forEach items="${layoutBean.caseSearchDisplayFields}" var="colDef">

       

       

                          <ui:include src="includes/configDrivenColumn.xhtml">

                              <ui:param name="colDef" value="#{colDef}"/>

                              <ui:param name="tableId" value="caseSearchResultsForm"/>

                          </ui:include>

       

       

                      </c:forEach>

       

       

                       <f:facet name="footer">

                           <div>

                               <div style="float:left; line-height: 22px;">

                                  <h:outputText value="#{msg['casesearchpage.casesreturned.prefix']} #{caseBean.caseCount}" rendered="#{not empty msg['casesearchpage.casesreturned.prefix']}" />

                                  <h:inputHidden id="casesReturned" value="#{caseBean.caseCount}" />

                               </div>

                               <div style="float:right;">

                                   <rich:dataScroller fastControls="hide">

       

       

                                       <f:facet name="first">

                                          <h:outputText value="#{msg['generic.button.first']}"/>

                                        </f:facet>

       

       

                                       <f:facet name="previous">

                                          <h:outputText value="#{msg['generic.button.previous']}"/>

                                        </f:facet>

       

       

                                       <f:facet name="next">

                                          <h:outputText value="#{msg['generic.button.next']}"/>

                                        </f:facet>

       

       

                                        <f:facet name="last">

                                          <h:outputText value="#{msg['generic.button.last']}"/>

                                        </f:facet>

                                   </rich:dataScroller>

                               </div>

                               <div style="clear:both;"></div>

                           </div>

                       </f:facet>

       

       

                  </rich:dataTable>

       

       

                   <!--<h:outputText rendered="${not caseBean.hasResults}" value="${msg['casesearchpage.nowrows.message']}" style="display:block; margin: 5px 0px;" />-->

       

       

               </h:form>

          </h:panelGroup>

       

      CaseBean.java

       

          private CasesDataModel casesDataModel;

       

          @Autowired

          public void setCasesDataModel(CasesDataModel casesDataModel) {

              this.casesDataModel = casesDataModel;

          }

       

          public CasesDataModel getTableModel() {

              return casesDataModel;

          }

       

          public String search() {

              log.debug("Attempting to get cases");

              try {

                  casesDataModel.setCriteria(getSearchFieldConfig().getAllFields());

                  //SearchResults<CaseSummary> results = caseService.getCases(getSearchFieldConfig().getAllFields());

                  //cases = results.getPageAsList();

              } catch (PAMException rex) {

                  addErrorMessage("casesearchpage.error.retrieving.cases");

                  log.error("Failed to get cases : " + rex.getMessage());

              }

              return "success";

          }

       

      CasesDataModel.java

       

      public class CasesDataModel extends ExtendedDataModel implements Arrangeable {

       

       

          private static Log log = LogFactory.getLog(CasesDataModel.class);

       

       

          private CaseService caseService;

       

       

          private Object rowKey;

          private SearchResults<CaseSummary> cachedSearchResults;

          private List<ConfigFieldValue> cachedSearchCriteria;

          private SequenceRange cacheSequenceRange;

       

       

          private SortField cachedSortField;

       

       

          public void setCriteria(List<ConfigFieldValue> searchFields) {

              log.debug("New search, clearing cache");

              clearCache(true);

              this.cachedSearchCriteria = searchFields;

          }

       

       

          private void clearCache(boolean fullClear) {

              log.debug("...Clearing case search paging cache, full clear : " + fullClear);

              this.cachedSearchResults = null;

              this.cachedSortField = null;

       

       

              // If its a sort then we don't change search criteria

              if (fullClear) {

                  this.cachedSearchCriteria = null;

                  this.cacheSequenceRange = null;

              }

       

       

          }

       

       

          @Autowired

          public void setCaseService(CaseService caseService) {

              this.caseService = caseService;

          }

       

       

          @Override

          public void setRowKey(Object rowKey) {

              this.rowKey = rowKey;

          }

       

       

          @Override

          public Object getRowKey() {

              return rowKey;

          }

       

       

          @Override

          public void walk(FacesContext facesContext, DataVisitor visitor, Range range, Object argument) {

              if (cachedSearchCriteria != null) {

                  SequenceRange sequenceRange = (SequenceRange) range;

                  if (cachedSearchResults == null || hasRangeChanged(sequenceRange, cacheSequenceRange)) {

                      // range has changed or there are no results so call case service to retrieve cases

                      Integer firstRowIndex;

                      Integer pageSize;

                      String sortDirection = null;

                      String sortColumn = null;

       

       

                      // Set the paging data

                      if (sequenceRange != null) {

                          firstRowIndex = sequenceRange.getFirstRow();

                          pageSize = sequenceRange.getRows();

                          log.debug("Setting paging data to start index " + firstRowIndex + ", rows per page : " + pageSize);

                      } else {

                          firstRowIndex = 0;

                          pageSize = Integer.MAX_VALUE;

                      }

                      // Set teh sorting

                      if (cachedSortField != null) {

                          sortDirection = cachedSortField.getSortOrder().toString();

                          sortColumn = (String)ExprBean.resolveExpression(facesContext, cachedSortField.getSortBy());

                          log.debug("Sorting required, field " + sortColumn + ", direction : " + sortDirection);

                      }

       

       

                      log.debug("Calling case service");

                      cachedSearchResults = caseService.getCases(cachedSearchCriteria, firstRowIndex, pageSize, sortColumn, sortDirection);

                      log.debug("Caching cases page returned of " + cachedSearchResults.getPage().size() + ", total cases " + cachedSearchResults.getTotalCount());

       

       

                      cacheSequenceRange = sequenceRange;

       

       

                  }

              }

       

       

              if (cachedSearchResults != null && !cachedSearchResults.getPage().isEmpty()) {

                  log.debug("performing visitor.process() on "+ cachedSearchResults.getPage().size() +" cases");

                  for (CaseSummary caseObj : cachedSearchResults.getPage()) {

                      visitor.process(facesContext, caseObj.getReference(), argument);

                  }

              }

          }

       

       

          private boolean hasRangeChanged(SequenceRange range1, SequenceRange range2) {

              if (range1 == null || range2 == null) {

                  return (range1 != range2);

              } else {

                  return !((range1.getFirstRow() == range2.getFirstRow()) && (range1.getRows() == range2.getRows()));

              }

          }

       

       

          @Override

          public boolean isRowAvailable() {

              return (getRowData() != null);

          }

       

       

          @Override

          public int getRowCount() {

              return cachedSearchResults == null ? 0 : cachedSearchResults.getTotalCount();

          }

       

       

          @Override

          /**

           * Returns the CaseSummary object matching the current ID th from the cache

           */

          public CaseSummary getRowData() {

              log.debug("Finding case for reference : " + rowKey);

              if (cachedSearchResults != null) {

                  for (CaseSummary caseObj : cachedSearchResults.getPage()) {

                      if (caseObj.getReference().equals(rowKey)) {

                          log.debug("... FOUND !");

                          return caseObj;

                      }

                  }

              }

              return null;

          }

       

       

          @Override

          /**

           * Only required to be implemented properly when using ExtendedDataTable

           */

          public int getRowIndex() {

              return -1;

          }

       

       

          @Override

          /**

           * Only required to be implemented properly when using ExtendedDataTable

           */

          public void setRowIndex(int index) {

              throw new UnsupportedOperationException();

          }

       

       

          @Override

          public Object getWrappedData() {

              throw new UnsupportedOperationException();

          }

       

       

          @Override

          public void setWrappedData(Object o) {

              throw new UnsupportedOperationException();

          }

       

       

          @Override

          public void arrange(FacesContext facesContext, ArrangeableState state) {

              if (state != null) {

                  log.debug("Sorting applied, clearing cache");

                  clearCache(false);

                  this.cachedSortField = (state.getSortFields() == null || state.getSortFields().isEmpty()) ? null : state.getSortFields().get(0);

              }

          }

       

      Log

       

      Action : Click Search Button

      Result : No results returned

      Logging...

       

      DEBUG [17:36:16,175] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:36:16,218] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:36:16,219] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: APPLY_REQUEST_VALUES 2 - /caseSearch.jsf

      DEBUG [17:36:16,276] (CasesDataModel.java:46) - New search, clearing cache

      DEBUG [17:36:16,276] (CasesDataModel.java:52) - ...Clearing case search paging cache, full clear : true

      DEBUG [17:36:16,278] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  APPLY_REQUEST_VALUES 2 - /caseSearch.jsf

      DEBUG [17:36:16,278] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RENDER_RESPONSE 6 - /caseSearch.jsf

      DEBUG [17:36:16,341] (CasesDataModel.java:94) - Setting paging data to start index 0, rows per page : 2

      DEBUG [17:36:16,341] (CasesDataModel.java:106) - Calling case service

      DEBUG [17:36:22,350] (CasesDataModel.java:108) - Caching cases page returned of 2, total cases 4

      DEBUG [17:36:22,350] (CasesDataModel.java:116) - performing visitor.process() on 2 cases

      DEBUG [17:36:22,351] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:36:22,351] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:36:22,351] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:36:22,352] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:36:22,352] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:36:22,355] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:36:22,361] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:36:22,362] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:36:22,362] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:36:22,363] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:36:22,363] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:36:22,363] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:36:22,365] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RENDER_RESPONSE 6 - /caseSearch.jsf

       

       

      Action : Click Search Button Again

      Result : Same, No results returned

      Logging...

       

      DEBUG [17:37:24,529] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:37:24,566] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:37:24,567] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: APPLY_REQUEST_VALUES 2 - /caseSearch.jsf

      DEBUG [17:37:24,570] (CasesDataModel.java:46) - New search, clearing cache

      DEBUG [17:37:24,570] (CasesDataModel.java:52) - ...Clearing case search paging cache, full clear : true

      DEBUG [17:37:24,572] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  APPLY_REQUEST_VALUES 2 - /caseSearch.jsf

      DEBUG [17:37:24,572] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RENDER_RESPONSE 6 - /caseSearch.jsf

      DEBUG [17:37:24,598] (CasesDataModel.java:94) - Setting paging data to start index 0, rows per page : 2

      DEBUG [17:37:24,598] (CasesDataModel.java:106) - Calling case service

      DEBUG [17:37:25,609] (CasesDataModel.java:108) - Caching cases page returned of 2, total cases 4

      DEBUG [17:37:25,609] (CasesDataModel.java:116) - performing visitor.process() on 2 cases

      DEBUG [17:37:25,610] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:37:25,610] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:37:25,611] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:37:25,611] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:37:25,612] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:37:25,613] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:37:25,613] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:37:25,614] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:37:25,614] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:37:25,615] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:37:25,615] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:37:25,616] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:37:25,617] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RENDER_RESPONSE 6 - /caseSearch.jsf

       

      Action : Click Column header to do a sort

      Result : Results page returned

      Logging...

       

      DEBUG [17:38:47,470] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:38:47,473] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:38:47,473] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RENDER_RESPONSE 6 - /caseSearch.jsf

      DEBUG [17:38:47,511] (CasesDataModel.java:116) - performing visitor.process() on 2 cases

      DEBUG [17:38:47,512] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:38:47,512] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,512] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:38:47,513] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,800] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:38:47,801] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,801] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:38:47,801] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,815] (CasesDataModel.java:116) - performing visitor.process() on 2 cases

      DEBUG [17:38:47,815] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:38:47,815] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,816] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:38:47,816] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,816] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:38:47,816] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,820] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:38:47,820] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,820] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:38:47,821] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,821] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:38:47,821] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:38:47,822] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RENDER_RESPONSE 6 - /caseSearch.jsf

       

      Action : Click Next Button

      Result : Results page returned

      Logging...

       

      DEBUG [17:40:48,705] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:40:48,737] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:40:48,737] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: APPLY_REQUEST_VALUES 2 - /caseSearch.jsf

      DEBUG [17:40:48,740] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  APPLY_REQUEST_VALUES 2 - /caseSearch.jsf

      DEBUG [17:40:48,741] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: PROCESS_VALIDATIONS 3 - /caseSearch.jsf

      DEBUG [17:40:48,743] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  PROCESS_VALIDATIONS 3 - /caseSearch.jsf

      DEBUG [17:40:48,743] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: UPDATE_MODEL_VALUES 4 - /caseSearch.jsf

      DEBUG [17:40:48,744] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  UPDATE_MODEL_VALUES 4 - /caseSearch.jsf

      DEBUG [17:40:48,744] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: INVOKE_APPLICATION 5 - /caseSearch.jsf

      DEBUG [17:40:48,745] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  INVOKE_APPLICATION 5 - /caseSearch.jsf

      DEBUG [17:40:48,748] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RENDER_RESPONSE 6 - /caseSearch.jsf

      DEBUG [17:40:48,791] (CasesDataModel.java:94) - Setting paging data to start index 2, rows per page : 2

      DEBUG [17:40:48,792] (CasesDataModel.java:106) - Calling case service

      DEBUG [17:40:51,537] (CasesDataModel.java:108) - Caching cases page returned of 2, total cases 4

      DEBUG [17:40:51,538] (CasesDataModel.java:116) - performing visitor.process() on 2 cases

      DEBUG [17:40:51,538] (CasesDataModel.java:146) - Finding case for reference : SRG00047

      DEBUG [17:40:51,539] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,539] (CasesDataModel.java:146) - Finding case for reference : SRG00047

      DEBUG [17:40:51,540] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,570] (CasesDataModel.java:146) - Finding case for reference : SRG00048

      DEBUG [17:40:51,570] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,570] (CasesDataModel.java:146) - Finding case for reference : SRG00048

      DEBUG [17:40:51,571] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,582] (CasesDataModel.java:116) - performing visitor.process() on 2 cases

      DEBUG [17:40:51,583] (CasesDataModel.java:146) - Finding case for reference : SRG00047

      DEBUG [17:40:51,583] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,583] (CasesDataModel.java:146) - Finding case for reference : SRG00047

      DEBUG [17:40:51,584] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,584] (CasesDataModel.java:146) - Finding case for reference : SRG00047

      DEBUG [17:40:51,584] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,588] (CasesDataModel.java:146) - Finding case for reference : SRG00048

      DEBUG [17:40:51,588] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,588] (CasesDataModel.java:146) - Finding case for reference : SRG00048

      DEBUG [17:40:51,589] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,589] (CasesDataModel.java:146) - Finding case for reference : SRG00048

      DEBUG [17:40:51,589] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:40:51,590] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RENDER_RESPONSE 6 - /caseSearch.jsf

       

      Action : Click Search Button

      Result : No results returned

      Logging...

       

      DEBUG [17:41:44,001] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:41:44,029] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RESTORE_VIEW 1 - /caseSearch.jsf

      DEBUG [17:41:44,029] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: APPLY_REQUEST_VALUES 2 - /caseSearch.jsf

      DEBUG [17:41:44,031] (CasesDataModel.java:46) - New search, clearing cache

      DEBUG [17:41:44,032] (CasesDataModel.java:52) - ...Clearing case search paging cache, full clear : true

      DEBUG [17:41:44,032] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  APPLY_REQUEST_VALUES 2 - /caseSearch.jsf

      DEBUG [17:41:44,032] (JSFPhaseTracker.java:31) - BEFORE JSF PHASE: RENDER_RESPONSE 6 - /caseSearch.jsf

      DEBUG [17:41:44,046] (CasesDataModel.java:94) - Setting paging data to start index 0, rows per page : 2

      DEBUG [17:41:44,047] (CasesDataModel.java:106) - Calling case service

      DEBUG [17:41:44,894] (CasesDataModel.java:108) - Caching cases page returned of 2, total cases 4

      DEBUG [17:41:44,895] (CasesDataModel.java:116) - performing visitor.process() on 2 cases

      DEBUG [17:41:44,895] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:41:44,896] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:41:44,896] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:41:44,897] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:41:44,897] (CasesDataModel.java:146) - Finding case for reference : SRG00045

      DEBUG [17:41:44,898] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:41:44,898] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:41:44,899] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:41:44,899] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:41:44,900] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:41:44,900] (CasesDataModel.java:146) - Finding case for reference : SRG00046

      DEBUG [17:41:44,901] (CasesDataModel.java:150) - ... FOUND !

      DEBUG [17:41:44,902] (JSFPhaseTracker.java:26) - AFTER JSF PHASE:  RENDER_RESPONSE 6 - /caseSearch.jsf

       

      So it seems to be and issue when I trigger the table to re render, any thoughts welcomed.

       

      Thanks,
      Dale

        • 1. Re: Struggling implementing ExtendedDataModel and my web service
          Brendan Healey Master

          Dale, I've written an abstract base class which theoretically adds a level of abstraction between your code

          and the ExtendedDataModel. Like you I read through practical richfaces 2, and this is what I came up with

          after some testing.

           

          The idea which should be pretty familiar is to create an instance of an anonymous subclass of RichLazyDataModel,

          overriding the getDataList(), getKey() & getTotalCount() methods. There is a comment in the attached code giving a

          usage example.

           

          I use this with RF 4.1.0.Final and so far it seems to work ok for me. Of course the problem could well be

          unconnected with the way you're implementing ExtendedDataModel,  in which case this can only eliminate a

          potential cause.

           

          Regards,

          Brendan.

          • 2. Re: Struggling implementing ExtendedDataModel and my web service
            Dale Ellis Newbie

            Thanks for your reply Brendan,

             

            I managed to get it working 2 days ago with a bit of a bodge and bit of refactoring to make it cleaner, I more or less have the same as your code except I don't cache the row numbers as I retreive the total as part of the web service call and I also check to see if sorting has changed to see if I need to go to refresh the data, sorting and criteria data are passed to my fetch method.

             

            Currently I only have one page that uses paging but I think I will mimic your approach as it makes sense to create a base super class to factor out common parts.

             

            Sorting and the paging buttons work absolutely fine, the only issue I have is that when I do a search the results don't get reflected until a subsquent request, so for a bodge I did this...

             

                    <a4j:commandButton id="searchSubmit" value="${caseBean.searchFieldConfig.button.label}" action="${caseBean.search}"

                    style="${caseBean.searchFieldConfig.button.style}"

                    onbegin="this.disabled=true"

                    oncomplete="#{rich:element('searchSubmitBodge')}.click();"

                    render="caseResultsContainer"/>

             

             

                    <a4j:commandButton id="searchSubmitBodge" action="${caseBean.none}" value="Load" render="caseResultsContainer"

                                       oncomplete="#{rich:element('searchSubmit')}.disabled=false; hideIfResultsReturned();" style="display:none;" />

             

            So that is the bodge, I call a action to force a re render of the table straight after the search and that all works fine. I'd love to know how to get that working properly but I'm just happy it's working at the moment.

             

            Cheers,

            Dale