6 Replies Latest reply on Sep 6, 2014 6:04 AM by Markus Morgenstern

    Render in rich:inplaceSelect works only the first time

    Markus Morgenstern Newbie

      Good evening community:

       

      My Setup:

      * A InplaceSelect with value 1-10

      * A BackingBean (TestBean) holding the selected value as well as deliviering the list items

       

      Bean

       

      @ManagedBean(name = "TestBean")
      @RequestScoped
      public class TestBean {
      
          private int selectedValue = 0;
      
          public TestBean() {
          }
      
          public ArrayList<SelectItem> getOptions() {
              ArrayList<SelectItem> result = Lists.newArrayList();
              for (int i = 0; i < 10; i++) {
                  result.add(new SelectItem(i, String.valueOf(i)));
              }
              return result;
          }
      
          public void invokeListener(){
              System.out.println("Invoke Listener");
          }
      
          public int getSelectedValue() {
              return selectedValue;
          }
      
          public void setSelectedValue(int selectedValue) {
              this.selectedValue = selectedValue;
          }
      }
      
      
      
      

       

      Html (http://pastebin.com/Y9YvsyMg)

       

      <?xml version='1.0' encoding='UTF-8' ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:rich="http://richfaces.org/rich"
           xmlns:a4j="http://richfaces.org/a4j"
           xmlns:f="http://java.sun.com/jsf/core">
          <h:head>
      
          </h:head>
          <h:body>
              <a4j:outputPanel id="testPanel" >
                  <h:form>
                      <h:panelGrid columns="3" cellpadding="30">
                          <h:outputText value="selected value"/>
                          <h:outputText value="#{TestBean.selectedValue}"/>
                          <rich:inplaceSelect value="#{TestBean.selectedValue}">
                              <a4j:ajax event="change" listener="#{TestBean.invokeListener()}" execute="@form"/>
                              <f:selectItems value="#{TestBean.options}"/>
                          </rich:inplaceSelect>
                      </h:panelGrid>
                  </h:form>
              </a4j:outputPanel>
          </h:body>
      </html>
      

       

       

      Of course I got this in a composite component but this is the minimum working example.

       

      Behaviour if not rendered:

      The Listener is called every time a value in the drop down is selected which is okay with me

       

      Behaviour if rendered:

      Only the first time the listener is called and the selected value is displayed correctly. After this first time the listener is not triggered anymore.

       

      I'm running on 4.3.5.Final

       

      Hopefully someone of you has an idea. I found similar problems but never a solution

       

      Thannks in advance!