2 Replies Latest reply on Mar 5, 2010 2:21 PM by poesys

    rich:suggestionBox doesn't work with rich:dataTable in 3.3.2

    poesys

      Using 3.3.2.SR1 GA RichFaces, I'm using the rich:suggestionBox inside a rich:column in a rich:dataTable, and the suggestionBox doesn't appear (Ajax request/response happens but box is never rendered). The suggestion box works fine if not in a data table/column. I saw the JIRA bugs for earlier versions, tried ajaxSingle="false", no effect. I can make the suggestionBox work by putting a region around it with renderRegionOnly = "true", but I can't put the region around both columns (necessary because the object is to fill in the second column based on the choice in the first using the a4j:support inside the suggestionBox component): once two columns are in the region, the suggestion box does not appear. Is this a possible regression bug or is there something I can do to make this work?

       

      Here's my code snippet:

       

                          <h:form>
                              <a4j:outputPanel id="submissionPanel">
                                  <a4j:log
                                      popup="true"
                                      level="ALL"
                                      width="800"
                                      height="400" />
                                  <rich:dataTable
                                      id="locusTable"
                                      rows="0"
                                      value="#{geneSubmission.genes}"
                                      var="gene"
                                      ajaxKeys="#{geneSubmission.genesToUpdate}">
                                      <rich:column>
                                          <h:inputText
                                              value="#{gene.locus}"
                                              id="locus"
                                              size="9">
                                          </h:inputText>
                                          <rich:suggestionbox
                                              suggestionAction="#{geneSubmission.suggestLoci}"
                                              var="l"
                                              for="locus"
                                              minChars="5"
                                              eventsQueue="locusQueue"
                                              ignoreDupResponses="true"
                                              fetchValue="#{l.name}"
                                              nothingLabel="No locus found"
                                              ajaxSingle="false"
                                              width="100"
                                              height="300">
                                              <h:column>
                                                  #{l.name}
                                              </h:column>
                                              <a4j:support
                                                  event="onselect"
                                                  action="#{geneSubmission.setLocusSymbol}"
                                                  reRender="symbol, fullName">
                                                  <f:setPropertyActionListener
                                                      value="#{l.name}"
                                                      target="#{gene.locus}" />
                                              </a4j:support>
                                          </rich:suggestionbox>
                                      </rich:column>
                                      <rich:column>
                                          <h:inputText
                                              value="#{gene.symbol}"
                                              id="symbol"
                                              size="5">
                                          </h:inputText>
                                      </rich:column>
                                      <rich:column>
                                          <h:inputText
                                              value="#{gene.fullName}"
                                              id="fullName"
                                              size="20"
                                              maxlength="200">
                                          </h:inputText>
                                      </rich:column>
                                  </rich:dataTable>
                              </a4j:outputPanel>
                          </h:form>
      
        • 1. Re: rich:suggestionBox doesn't work with rich:dataTable in 3.3.2
          ilya_shaikovsky

          addded column with suggestions to one of the demo samples and it works fine for me under 3.3.3-SNAPSHOT.

                    <rich:dataTable rowKeyVar="row" value="#{capitalsBean.capitals}" var="cap" rows="20" reRender="ds" id="simpletable">
                         <f:facet name="header">
                              <rich:columnGroup>
                                   <rich:column colspan="2" > 
                                        <h:outputText value="Filtering Example"/>
                                   </rich:column>     
                                   <rich:column breakBefore="true">
                                        <h:outputText value="State Name"/>
                                   </rich:column>
                                   <rich:column>
                                        <h:outputText value="State Capital"/>
                                   </rich:column>
                              </rich:columnGroup>
                         </f:facet>
                         <rich:column style="background-color:#{(row mod 2 eq 0)? a4jSkin.generalBackgroundColor : a4jSkin.additionalBackgroundColor}" filterBy="#{cap.state}" filterEvent="onkeyup" filterValue="#{capitalsBean.currentStateFilterValue}">
                              <h:outputText value="#{cap.state}"/>
                         </rich:column> 
                         <rich:column filterBy="#{cap.name}" filterEvent="onkeyup" filterValue="#{capitalsBean.currentNameFilterValue}">
                              <h:outputText value="#{cap.name}"/> 
                         </rich:column>
                         <rich:column>
                              <h:inputText id="in"/>
                              <rich:suggestionbox for="in" suggestionAction="#{capitalsBean.autocomplete}">
                                   <h:column >
                                        123
                                   </h:column>
                              </rich:suggestionbox>
                         </rich:column>
                         <f:facet name="footer">
                              <rich:datascroller id="ds" renderIfSinglePage="false"></rich:datascroller>
                         </f:facet>
          

          </rich:dataTable>

          • 2. Re: rich:suggestionBox doesn't work with rich:dataTable in 3.3.2
            poesys

            So, back to work

             

            I went through my code example and one-by-one removed all the attributes that weren't in Ilya's attempt to reproduce the problem.

             

            Voila: on removing the rich:dataTable attribute ajaxKeys

            ajaxKeys="#{geneSubmission.genesToUpdate}"

            everything worked. I went back to my original code, removed that attribute, and the original code now works fine.

             

            So my guess is that there is a bug involving a conflict between the suggestionBox data table and the outer data table involving the ajaxKeys functionality. Here is the minimal code that reproduces the problem for me:

             

                    <f:view>
                        <h:form>
                            <a4j:outputPanel id="submissionPanel">
                                <rich:dataTable
                                    id="locusTable"
                                    rows="20"
                                    value="#{geneSubmission.genes}"
                                    var="gene"
                                    ajaxKeys="#{geneSubmission.genesToUpdate}">
                                    <rich:column>
                                        <h:inputText
                                            value="#{gene.locus}"
                                            id="locus">
                                        </h:inputText>
                                        <rich:suggestionbox
                                            for="locus"
                                            suggestionAction="#{geneSubmission.suggestLoci}">
                                            <h:column>
                                                <h:outputText value="123" />
                                            </h:column>
                                        </rich:suggestionbox>
                                    </rich:column>
                                </rich:dataTable>
                            </a4j:outputPanel>
                        </h:form>
                    </f:view>
            
            

            The obvious workaround is to not use ajaxKeys in this situation. So I won't.