4 Replies Latest reply on Jul 21, 2010 6:59 AM by elenaveretilo

    The rich:comboBox doesnt invoke valueChangeListener second time

    elenaveretilo

      Hi! It's me again!

       

      I have next problem:

      I have one page - where I can show images, which I can get from certain directory (for example - call - /root).

      So I have the dropdown menu (I use rich:comboBox) to choose the directory with images (I can have more than one directory, but now I have only one).

      Then I have another page - where I upload image and save it in the neccessary directory (/root).

       

      And after I come back to first page and try to choose "/root" directory from comboBox - nothing happens. The table with images doesnt update and even valueChangeListener doesnt invoke.

       

      My bean - its session bean. I couldnt save it in request scope, so it must be in session.

       

      Here is my page code:

       

       

       

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:fc="http://www.fusioncharts.com"
       xmlns:t="http://myfaces.apache.org/tomahawk"
       template="template.xhtml">
       <ui:define name="title">Companies page</ui:define>
       <ui:define name="content">
       
       <style type="text/css">
       .pic-normal {
       width: 200px;
       border: 2px solid #ACBECE;
       
       }
       .wrap1 {
       width:260px;
       height: 200px;
       float: left;            
       }
       
       .button-width {
       width: 200px;
       height: 40px;             
       }
       </style>
       
       
       <h:panelGroup rendered="#{sessionBean.companyId != null}">
       <h:form id="clientAdminButtons"> 
       <h:panelGrid id = "buttonsPanelGrid" columns="4" style="width: 100%;">
       <h:commandButton value="Budget" action="setbudget" immediate="true" styleClass="button-width"/>
       <h:commandButton value="Sales" action="custom-import" immediate="true" styleClass="button-width"/>
       <h:commandButton value="Store sales" action="setstoresales" immediate="true" styleClass="button-width"/>
       <h:commandButton value="Load image from PPT" action="upload" immediate="true" styleClass="button-width"/>
       </h:panelGrid>
       </h:form>
       <br/><br/><br/>
       
       <table id="mainTable" style="width: 100%;">
       <tr>
       <td style="width: 30%;">
       <div id="leftDiv">
       Some information :)
       </div>
       </td>
       
       <td style="width: 70%;">
       <h:form id="clientAdminForm">
       <h:outputText value="Select user for preview his/her pages"/><br/><br/><br/>
       <div style="width: 900px;">
       <rich:comboBox id="selectClientPages" value="#{clientAdminBean.selectedDirectory}" defaultLabel="Select the user" width="300" 
       valueChangeListener="#{clientAdminBean.loadSelectedDirectory}">
       <f:selectItems value="#{clientAdminBean.companyDirectories}" />
       <a4j:support ajaxSingle="true" event="onselect" reRender="clientAdminForm"/>
       </rich:comboBox>
       <br/><br/><br/>     
       
       <rich:dataTable id="clientPages" rows="#{clientAdminBean.rowNumber}" width="100%" var="image" value="#{clientAdminBean.userImages}"> 
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Name"/>
       </f:facet>
       
       <h:outputText value="#{image.name}"/>
       </rich:column>
       
       <rich:column>
       <f:facet name="header">
       <h:outputText value="User pages"/>
       </f:facet>
       
       <h:graphicImage value="/#{clientAdminBean.webCompanyDirectory}/#{clientAdminBean.selectedDirectory}/#{image.name}.png" 
       style="width: 200px;" styleClass="jimg"/>
       </rich:column>
       
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Configure"/>
       </f:facet>
       
       <h:selectBooleanCheckbox id="hiddenCheckbox" value="#{image.available}">
       Show/hide
       </h:selectBooleanCheckbox>
       </rich:column>
       
       </rich:dataTable>
       <br/><br/>
       
       <h:commandButton id="saveChanges" value="Save changes" actionListener="#{clientAdminBean.saveChanges}"/>
       
       <rich:jQuery selector=".jimg" query="addClass('pic-normal')"/>
       <rich:jQuery selector=".jimg" query="wrap('&lt;div class=\'wrap1\'&gt;&lt;/div&gt;')" />
       <rich:jQuery selector=".jimg" query="mouseover(function(){enlargePic(this)})"/>
       <rich:jQuery selector=".jimg" query="mouseout(function(){normalPic(this)})"/>
       
       <rich:jQuery name="enlargePic" timing="onJScall" query="stop().animate({width:'300px'})" />
       <rich:jQuery name="normalPic" timing="onJScall" query="stop().animate({width:'200px'})" />
       
       </div>
       </h:form>
       
       </td>
       </tr>
       </table>
       
       </h:panelGroup>
       
       </ui:define>
       <ui:define name="return" />
      </ui:composition>
      

       

       

      I dont know why, but the html code isnt shown:

       

       

      I need your amazing minds as soon as possible.

       

      Any help will be appreciated)

       

      Thanks and good day)