3 Replies Latest reply on Jun 24, 2011 7:54 AM by Jakob Keres

    tabPanel switchType="ajax" and selectOneMenu issue

    Jakob Keres Newbie

      Hello,

       

      seems like a bug to me, following code is not working with switchType="ajax", it's just not switching the panel:

       

      <ui:define name="content">
              <h:form>
                  <rich:tabPanel switchType="ajax">
                      <rich:tab header="Overview">
                          <h:selectOneMenu id="selectOilType"
                              value="#{edit.measurement.oiltype}">
                              <f:selectItems value="#{edit.oilTypes}" var="_oilType"
                                  itemLabel="#{_oilType.name}" id="oiltypes_items" />
                          </h:selectOneMenu>
                      </rich:tab>
      
                      <rich:tab header="GC">
                      </rich:tab>
      
                      <rich:tab header="MS">
                      </rich:tab>
      
                  </rich:tabPanel>
              </h:form>
          </ui:define>
      

       

      The problem is the selectOneMenu, other inputtypes don't cause this behaviour.

       

      Changing the switchType to client solves the problem, but this is not what I want.

       

      Or am I doing something wrong? Richfaces is 4.0.0.Final.

       

      Regards

      Jakob

        • 1. Re: tabPanel switchType="ajax" and selectOneMenu issue
          Jakob Keres Newbie

          OK, similar problem with switchType="client".

           

          SelectOneMenu with int or String works, with Classes not.

           

           

          <html xmlns="http://www.w3.org/1999/xhtml"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:a4j="http://richfaces.org/a4j"
              xmlns:rich="http://richfaces.org/rich">
          
          <f:view contentType="text/html">
              <h:head>
                  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
                  <ui:insert name="head"></ui:insert>
                  <style type="text/css">
          </style>
              </h:head>
          
              <h:body>
                  <h:form>
                      <a4j:commandButton value="Test update" action="#{test.update}" />
                  </h:form>
                  
                  This works:
                  <rich:tabPanel switchType="client">
                      <rich:tab header="1st">
                      </rich:tab>
          
                      <rich:tab header="2nd">
                          <h:form>
                              <h:selectOneMenu>
                                  <f:selectItems value="#{test.intList}" />
                              </h:selectOneMenu>
                              <a4j:commandButton value="Save" action="#{test.update}" />
                          </h:form>
                      </rich:tab>
          
                      <rich:tab header="3rd">
                      </rich:tab>
          
                  </rich:tabPanel>
          
                  This not:
                  <rich:tabPanel switchType="client">
                      <rich:tab header="1st">
                      </rich:tab>
          
                      <rich:tab header="2nd">
                          <h:form>
                              <h:selectOneMenu>
                                  <f:selectItems value="#{test.classList}" />
                              </h:selectOneMenu>
                              <a4j:commandButton value="Save" action="#{test.update}" />
                          </h:form>
                      </rich:tab>
          
                      <rich:tab header="3rd">
                      </rich:tab>
          
                  </rich:tabPanel>
          
              </h:body>
          </f:view>
          </html>
          

           

           

          import java.util.ArrayList;
          import java.util.List;
          
          import org.springframework.context.annotation.Scope;
          import org.springframework.stereotype.Component;
          
          @Component("test")
          @Scope("session")
          public class Test {
          
              public List<Integer> getIntList() {
                  List<Integer> ret = new ArrayList<Integer>();
                  ret.add(1);
                  ret.add(2);
                  return ret;
              }
          
              public List<TestBean> getClassList() {
                  List<TestBean> ret = new ArrayList<TestBean>();
                  ret.add(new TestBean());
                  ret.add(new TestBean());
                  return ret;
              }
          
              public void update() {
                  System.out.println("update");
              }
          
              public class TestBean {
              }
          
          }
          
          • 2. Re: tabPanel switchType="ajax" and selectOneMenu issue
            Jakob Keres Newbie

            Sorry, it's me again....

            can anybody confirm this behaviour or is it just my problem?

             

            Ciao,

            Jakob

            • 3. Re: tabPanel switchType="ajax" and selectOneMenu issue
              Jakob Keres Newbie

              I was able to resolve this problem by replacing mojarra with myfaces...