6 Replies Latest reply on Oct 15, 2008 7:48 AM by ilya_shaikovsky

    rich:comboBox, rich:dataTable and reRender

    memema

      Something is wrong with rich:comboBox using with as external filter rich:dataTable after I rerender it. I use richfaces version 3.2.2.GA.

      My code is:

      test.xhtml


      <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:t="http://myfaces.apache.org/tomahawk"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       template="/wrapper.xhtml">
      
      <ui:define name="body">
      
       <h:form id="testId">
       <rich:dataTable value="#{testBackingBean.data}" var="item">
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column><t:outputText value="Test Column" /></rich:column>
       </rich:columnGroup>
       </f:facet>
      
       <rich:column>
       <f:facet name="header">
       <rich:comboBox defaultLabel="Enter some value">
       <f:selectItem itemValue="suggestion 1"/>
       <f:selectItem itemValue="suggestion 2"/>
       <f:selectItem itemValue="suggestion 3"/>
       <f:selectItem itemValue="suggestion 4"/>
       <f:selectItem itemValue="suggestion 5"/>
       </rich:comboBox>
       </f:facet>
      
       <t:outputText value="#{item}" />
       </rich:column>
       </rich:dataTable>
      
       <t:outputText value="RERENDER" style="cursor: pointer;">
       <a4j:support event="onclick"
       action="#{testBackingBean.testRequest}"
       reRender="testId" />
       </t:outputText>
       </h:form>
      
      </ui:define>
      </ui:composition>
      



      TestBackingBean.java

      package net.dimeg.mylios.backingbeans;
      
      import java.util.ArrayList;
      import java.util.Date;
      import java.util.List;
      
      public class TestBackingBean {
      
       public List<String> getData() {
       List<String> list = new ArrayList<String>();
       list.add("value1");
       list.add("value2");
       list.add("value3");
      
       return list;
       }
      
       public String getDateStr() {
       return (new Date()).toString();
       }
      
       public void testRequest() {
       System.out.println("TEST REQUEST");
       }
      }
      


      After I make RERENDER the combobox not opens for first time, and afrer that it pens and locks.

      Is there some workaround to use comboBox as filter field with rerendering, or not to rerender comboBox field?

      If this is a version BUG, can someone add it to JIRA?



        • 1. Re: rich:comboBox, rich:dataTable and reRender
          ilya_shaikovsky

          just checked

           <h:form>
           <rich:comboBox suggestionValues="#{capitalsBean.capitalsNames}" id="combo"
           directInputSuggestions="true" defaultLabel="Enter some value" />
          
          <a4j:commandButton reRender="combo"></a4j:commandButton>
          </h:form>
          


          without problems for me.

          Do you have any client side errors?

          • 2. Re: rich:comboBox, rich:dataTable and reRender
            memema

            Check out the topic of post :).

            Yes, if you rerender simple combo box, it works well. But try insert it to rich:dataTable header as in my example. I just want to make simple dataTable external filtering with comboBox.

            • 3. Re: rich:comboBox, rich:dataTable and reRender
              ilya_shaikovsky

              ok.. at richfaces demosite environment I've modified filtering feature page to

               <h:form>
               <rich:dataTable value="#{capitalsBean.capitals}" var="cap" id="table" rows="20">
               <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 Time Zone" />
               </rich:column>
               </rich:columnGroup>
               </f:facet>
               <rich:column filterMethod="#{filteringBean.filterStates}">
               <f:facet name="header">
               <rich:comboBox value="#{filteringBean.filterValue}" id="combo">
               <f:selectItem itemValue="123"/>
               <f:selectItem itemValue="123"/>
               <f:selectItem itemValue="123"/>
               <f:selectItem itemValue="123"/>
               </rich:comboBox>
               </f:facet>
               <h:outputText value="#{cap.state}" />
               </rich:column>
               <rich:column
               filterExpression="#{fn:containsIgnoreCase(cap.timeZone, filteringBean.filterZone)}">
               <f:facet name="header">
               <h:selectOneMenu value="#{filteringBean.filterZone}">
               <f:selectItems value="#{filteringBean.filterZones}" />
               <a4j:support event="onchange" reRender="table, ds2" />
               </h:selectOneMenu>
               </f:facet>
               <h:outputText value="#{cap.timeZone}" />
               </rich:column>
               <f:facet name="footer">
               <rich:datascroller id="ds2" renderIfSinglePage="false"></rich:datascroller>
               </f:facet>
               </rich:dataTable>
               <a4j:commandButton reRender="combo"></a4j:commandButton>
               </h:form>
              


              Still works for me. Feel free to add an issue to jira if you able to attch war sample.

              • 4. Re: rich:comboBox, rich:dataTable and reRender
                ilya_shaikovsky

                B.t.w. FF3 and IE7 checked.

                • 5. Re: rich:comboBox, rich:dataTable and reRender
                  memema

                  Ilya, in your example you rerender only "combo"

                  <a4j:commandButton reRender="combo"></a4j:commandButton>
                  .

                  Have you tried to filter the table first? (pressing second filter field and then look that happens with comboBox)

                  Try in your code to change rerendering from combo to table. New code will be:

                  <a4j:commandButton reRender="table"></a4j:commandButton>
                  .

                  If it will work for you, i will try to find bug in my environment, if not, I will try to commit issue to JIRA with war.



                  • 6. Re: rich:comboBox, rich:dataTable and reRender
                    ilya_shaikovsky

                    thanks for your points. Now we finally got it:

                    https://jira.jboss.org/jira/browse/RF-4613

                    feel free to post your additions.