2 Replies Latest reply on Feb 29, 2008 7:58 AM by Anne Childress

    scrollableDataTable and commandButton problem-URGENT

    Anne Childress Newbie

      I have a scrollableDataTable on a page that is loaded into an a4j:outputPanel (maincontent) via an a4j:include on a page via a rich:tree node selection. This page has a selectOneMenu to choose the table sort. The page loads just fine for first load, but when a new sort mode is chosen and the commandButton is pressed, the backing bean property bound to the selectOneMenu is never updated, so the scrollableDataTable just reloads as is. Curiously, if I load the page by itself in the browser, the sort property gets populated, and the table is sorted. This just doesn't make any sense.

      The main page code:

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:u="http:/jsf.exadel.com/template/util"
       xmlns:custom="http://doc/jsf/custom"
       template="pagetemplate.xhtml">
       <link rel="stylesheet" type="text/css" media="all" href="#{facesContext.externalContext.requestContextPath}/css/default.css"/>
       <ui:define name="left">
       <rich:panelBar height="460" width="300">
       <rich:panelBarItem label="DOP Intake" rendered="#{custom:roleRender('DOP')}">
       <h:form id="maintree">
       <rich:panel>
       <rich:tree nodeSelectListener="#{DOPIntakeMenuBean.processSelection}" adviseNodeOpened="#{DOPIntakeMenuBean.adviseNodeOpened}"
       switchType="client"
       value="#{DOPIntakeMenuBean.treeNode}" var="item" iconLeaf="/images/spacer.gif">
       <rich:treeNode>
       <a4j:commandLink reRender="maincontent" value="#{item.itemText}" >
       <a4j:actionparam name="listIndex" value="0" assignTo="#{DOPIntakeMenuBean.listIndex}"/>
       <a4j:actionparam name="refreshList" value="true" assignTo="#{DOPIntakeMenuBean.refreshList}"/>
       </a4j:commandLink>
       </rich:treeNode>
       </rich:tree>
       </rich:panel>
       </h:form>
       </rich:panelBarItem>
       <rich:panelBarItem label="DCC Intake" rendered="#{custom:roleRender('DCC')}">
       This is a test.
       </rich:panelBarItem>
       </rich:panelBar>
       </ui:define>
       <ui:define name="content">
       <a4j:outputPanel ajaxRendered="true" id="maincontent">
       <a4j:include id="treeview" viewId="#{DOPIntakeMenuBean.selectedURL}"/>
       </a4j:outputPanel>
       </ui:define>
      </ui:composition>
      


      The included page code:
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:u="http:/jsf.exadel.com/template/util" >
       <link rel="stylesheet" type="text/css" media="all" href="#{facesContext.externalContext.requestContextPath}/css/default.css"/>
       <h:form id="dopdiagprocassignform">
       <rich:panel id="dopdiagprocassignpanel" style="width: 100%; height: 500px;">
       <f:facet name="header">Diagnostic Processing Assignments</f:facet>
       <table>
       <tr>
       <td align="right">
       <h:outputLabel styleClass="stdLabel" for="diagFacCombo" value="Facility: "/>
       </td>
       <td align="left">
       <h:selectOneListbox disabled="true" size="1" id="diagFacCombo" value="#{DOPIntakeArrivalsBean.facilityID}">
       <f:selectItems value="#{CodeCacheBean.getCodes$['diagFacilityCode']}"/>
       </h:selectOneListbox>
       </td>
       </tr>
       <tr>
       <td align="left" colspan="2">
       <h:outputText value="Sort By:" styleClass="stdLabel"/>
       <h:selectOneListbox size="1" id="dopdiagprocassignpanelSort" value="#{DOPIntakeArrivalsBean.offenderSort}">
       <f:selectItem itemLabel="Arrival Date" itemValue="scheduledArrivalDate"/>
       <f:selectItem itemLabel="Birth Date" itemValue="birthDate"/>
       <f:selectItem itemLabel="Last Name" itemValue="offenderLastName"/>
       <f:selectItem itemLabel="Offender ID" itemValue="offenderID"/>
       <f:selectItem itemLabel="Offense Type" itemValue="primaryFelonyMisdemeanorDisplay"/>
       </h:selectOneListbox>
       <h:outputText value=" " styleClass="stdLabel"/>
       <a4j:commandButton value="Sort" actionListener="#{DOPIntakeArrivalsBean.retrieveOffenderList}" reRender="offenderList"/>
       </td>
       </tr>
       </table>
       <rich:panel id="dopdiagprocassignrpanel1" style="margin-top: 10px;">
       <f:facet name="header">Assignment Offenders</f:facet>
       <style type="text/css">
       .dr-sdt-bcbody { height:98px; }
       .dr-sdt { margin-left: 6px; }
       </style>
       <rich:spacer height="6px"></rich:spacer>
       <rich:scrollableDataTable ajaxRendered="true"
       width="96%" height="380px" id="offenderList" value="#{DOPIntakeArrivalsBean.arrivalOffenders}" var="ArrivalOffenderBean">
       <rich:column id="offenderID" width="320px">
       <f:facet name="header"><h:outputText value="Offender" /></f:facet>
       <h:panelGrid columns="4">
       <f:facet name="header"><h:outputText value="#{ArrivalOffenderBean.offenderName}" styleClass="panelGridHeader" /></f:facet>
       <h:outputText value="Offender ID:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.offenderID}" styleClass="gridText"/>
       <h:outputText value=" " styleClass="stdLabel"/>
       <h:outputText value=" " styleClass="stdLabel"/>
       <h:outputText value="Arrival Date:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.scheduledArrivalDateDisplay}" styleClass="gridText"/>
       <h:outputText value="County:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.convictionCountyDisplay}" styleClass="gridText"/>
       <h:outputText value="Offense Type:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.primaryFelonyMisdemeanorDisplay}" styleClass="gridText"/>
       <h:outputText value="Gender:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.genderDisplay}" styleClass="gridText"/>
       <h:outputText value="Sentence Length:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.sentenceLengthDisplay}" styleClass="gridText"/>
       <h:outputText value="Race:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.raceDisplay}" styleClass="gridText"/>
       <h:outputText value="Spec Char:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.specialCharacteristicsDisplay}" styleClass="gridText"/>
       <h:outputText value="Birth Date:" styleClass="gridLabel"/>
       <h:outputText value="#{ArrivalOffenderBean.birthDateDisplay}" styleClass="gridText"/>
       </h:panelGrid>
       </rich:column>
       <rich:column id="adminTech" width="300px">
       <f:facet name="header"><h:outputText value="Admin Tech/Case Analyst" /></f:facet>
       <h:panelGrid columns="2">
       <h:outputText value="Admin Tech:" styleClass="gridLabel"/>
       <h:selectOneMenu id="adminTechCombo" value="#{ArrivalOffenderBean.adminTech}">
       <f:selectItems value="#{ShallowEmployeeBean.getAdminTechs$[DOPIntakeScheduledArrivalsBean.facilityID]}" />
       </h:selectOneMenu>
       <h:outputText value="Case Analyst:" styleClass="gridLabel"/>
       <h:selectOneMenu id="caseAnalystCombo" value="#{ArrivalOffenderBean.caseAnalyst}">
       <f:selectItems value="#{ShallowEmployeeBean.getCaseAnalysts$[DOPIntakeScheduledArrivalsBean.facilityID]}" />
       </h:selectOneMenu>
       </h:panelGrid>
       </rich:column>
       </rich:scrollableDataTable>
       </rich:panel>
       </rich:panel>
       </h:form>
      </ui:composition>
      


      Also, if I name the page specifically in the a4j:include instead of getting the page url to load from my backing bean, the sort functionality works as well. I just really need to include the maincontent based on the tree selection, so hardcoding this one page url as the included view name isn't an option.

      It took FOREVER just to get the scrollableDataTable working as I'd like, so this wrinkle is quite annoying. I'd appreciate any help the richfaces team can provide.

      By the way, I'm using:
      facelets 1.1.12
      richfaces 3.1.4GA
      JSF 1.2

      I tried the richfaces 3.2 snapshot, but the scrollableDataTable was completely fubar because I'm using IE6.0 and apparently the javascript just does not play well with this version of IE. I'd like to get this work stable before I tackle upgrading releases.

        • 1. Re: scrollableDataTable and commandButton problem-URGENT
          Tsikhon Kuprevich Newbie

          Could you please attach a war file of your project?

          • 2. Re: scrollableDataTable and commandButton problem-URGENT
            Anne Childress Newbie

            Thank you for replying. I'd love to post a war file, but my app uses a secure database (government data), giving you the war without the backing data wouldn't do much good. I finally figured out what the problem was last night, and it had to do with the data populating one of the selectOneMenus in the second column of the scrollableDataTable. Without going into horrific detail, apparently one of the keys of a selectItem had two trailing spaces "LCC ". The page initially loaded successfully with the selectOneMenu that contained the offending selectItem. Once the commandButton was pressed, and the page data was sent, the offending selectItem's URL representation was altered "LCC%20" (only one trailing space), and somehow caused the Faces rendered to effectively ignore the request. I've not yet figured out why a missing "%20" would cause this, but I'll post another reply if I can figure it out. I do know that it was the problem because I changed the key of the data in the database to "LCC09" and everything worked fine.