0 Replies Latest reply on Feb 17, 2011 11:01 AM by Chris Valencia

    extendedDataTable column a4j support

    Chris Valencia Newbie

      I am using an extendedDataTable to display a list of products associated with a treatment that is selected from a rich:comboBox.  Once the table is rendered depending on the selection in the combo box the table has a check h:selectBooleanCheckbox in the first column so a user can select the product.  There is an a4j:support associated with the check box set to listen for an onclick (please see code below).  What I am seeing is that on initial page load the table has no data bound as the user has not made a selection from the comboBox.  When data is bound to the data following the reRender of the panel the onclick will not fire in the check box.  I am currently working around this by default selecting the first item in the combo box on load because if there is data in the data table when it is initialized then the onclick works fine.  However, not all of the selections are guaranteed to have options.  Is there a workaround, or something I am missing?  Or is this just a limitation of the extendedDataTable? 

       

       

      <a4j:outputPanel id="treatmentReasonEditPanel" >
              <a4j:form>
      
      
                  <rich:panel header="Treatment Reason Information"
                              style="position:relative;top:5px; width:600px"
                              headerClass="head1" id="treatmentInfoPanel">
                      <h:panelGrid columns="2"
                                   columnClasses="left_col, right_col">
                          <h:outputText value="Treatment Name:" styleClass="fieldStyle1"/>
                          <rich:comboBox id="treatmentComboBox"
                                         disabled="#{treatmentProductSelection.isEdit}"
                                          value="#{treatmentProductSelection.treatmentName}"
                                          suggestionValues="#{treatmentProductSelection.treatmentNameSuggestionList}"
                                          directInputSuggestions="true">
      
      
                              <a4j:support event="onchange" reRender="productSelectionPanel"
                                           oncomplete="productAdoptEditDialogHeight()"
                                           status="waitStatus"/>
                          </rich:comboBox>
                          <h:outputText value="Treatment Description:" styleClass="fieldStyle1"/>
                          <h:inputTextarea id="tpDescription"
                                           disabled="true"
                                           value="#{treatmentProductSelection.treatmentDescription}"
                                           rows="2"/>
      
      
                      </h:panelGrid>
                      <br/>
                  </rich:panel>
                  <rich:panel header="Products"
                              style="position:relative;top:5px; width:600px"
                              headerClass="head1" id="productSelectionPanel">
                       <rich:extendedDataTable id="productTable"
                                          rendered="#{!empty treatmentProductSelection.treatmentName}"
                                              value="#{treatmentProductSelection.productList}"
                                              var="product"
                                              width="560px"
                                              height="175px"
                                              sortMode="ascending"
                                              selectionMode="single"
                                              tableState=""
                                              style="margin-top:10px;"
                                              rowClasses="row1,row2" selectedClass="rowSelected"
                                              columnClasses=""
                                              noDataLabel="No Products Defined for this Treatment">
      
      
                           <rich:column width="75" headerClass="head3">
                              <f:facet name="header">
                                  Selected
                              </f:facet>
                              <h:selectBooleanCheckbox value="#{product.selectedProduct}">
                                  <a4j:support event="onclick" reRender="productTable, treatmentTable" 
                                               actionListener="#{treatmentProductSelection.captureProductChoice}" ignoreDupResponses="true">
                                      <f:attribute name="selectedId" value="#{product.treatmentDrug.id}" />
                                  </a4j:support>
                              </h:selectBooleanCheckbox>
                           </rich:column>
      
                          <rich:column width="175" headerClass="head3">
                              <f:facet name="header">
                                  Name
                              </f:facet>
                              <h:outputText value="#{product.treatmentDrug.name}" />
                          </rich:column>
                          <rich:column width="350" headerClass="head3">
                              <f:facet name="header">
                                  Description
                              </f:facet>
                              <h:outputText value="#{product.treatmentDrug.description}" />
                          </rich:column>
      
      
                        </rich:extendedDataTable>
      
      
      
      
                  </rich:panel>
                  <br/>
                      <my:createEditControls saveAction="saveTreatmentProductSelection"
                                             saveRendered="showSave"
                                             saveOnComplete="adoptEditDialogHeight()"
                                             saveReRender="editPanelContent, treatmentProgramTable"
                                             deleteRendered="isEdit"
                                             deleteOnComplete="#{rich:component('treatementDeleteConfirmation')}.show()"
                                             backingBean="#{treatmentProductSelection}"
                                             closeOnComplete="#{rich:component('productEditPanel')}.hide()"/>
              </a4j:form>
          </a4j:outputPanel>