3 Replies Latest reply on Jun 16, 2010 5:45 PM by Akaine Harga

    Refreshing rich:comboBox value after record was added or deleted

    Leonid Sokolin Newbie

      I noticed that rich:comboBox doesn't refresh the value after it was removed from its list.

       

      For example, I have a record that I want to delete from the DB.

       

      It is selected in combo box and I click on the button to delete it. After processing is done combo box list is updated and no longer shows the record, but it still shows as value on the screen. it looks kind of weird.

       

      Same thing happen sometimes when I have a record, which I want to save under different name. I change the name and click on Save button. Record is saved correctly in DB and shows in the list, but old one still appears as value.

       

      Anybody has an idea what might be wrong? I attached the XHTML code below and backing bean as the file.

       

      Combo box in question has id "template" and functions are Delete and Save.

       

      <

      div id="templateDiv" class="div-border">

       

      <a4j:region>

       

      <h:panelGrid id="templateParams" columns="6" style="padding-top:10px;">

       

      <h:outputText value="Templates:" style="font-weight:bold" />

       

      <rich:comboBox id="template" width="300" value="#{qtBeanParam.templateName}"

       

      immediate="true" enableManualInput="true"

       

      converter="#{templateConverter}" >

       

      <a4j:support event="onselect" reRender="template,templateList" ajaxSingle="true" />

       

      <a4j:support event="onchange" reRender="template,templateList" ajaxSingle="true" />

       

      <f:selectItems id="templateList" value="#{qtBeanParam.templateList}" />

       

      </rich:comboBox>

       

      <h:outputText value="Owners:" style="font-weight:bold" />

       

      <rich:comboBox id="templateOwner" width="160" value="#{qtBeanParam.templateOwner}"

       

      immediate="true" enableManualInput="false"

       

      valueChangeListener="#{qtBeanParam.changeTemplateOwner}" >

       

      <a4j:support event="onselect" reRender="template, templateList" ajaxSingle="true" />

       

      <f:selectItems id="templateOwnerList" value="#{qtBeanParam.templateOwnersList}" />

       

      </rich:comboBox>

       

      </h:panelGrid>

       

      <h:panelGrid columns="1">

       

      <rich:message for="templateParams" errorClass="rich-message-error" infoClass="rich-message-info" />

       

      </h:panelGrid>

       

      </a4j:region>

       

       

      <h:panelGrid id="templateButtons" columns="3" style="padding-bottom:10px;">

       

      <a4j:commandButton id="saveTemplate" value="Save"

       

      action="#{qtBeanParam.saveTemplate}" immediate="false" reRender="template,templateList,templateOwner,templateOwnerList"

       

      styleClass="blue-button">

       

      </a4j:commandButton>

       

      <a4j:commandButton id="deleteTemplate" value="Delete"

       

      action="#{qtBeanParam.deleteTemplate}" immediate="true" reRender="template,templateList,templateOwner,templateOwnerList"

       

      styleClass="blue-button">

       

      </a4j:commandButton>

       

      <a4j:commandButton id="loadTemplate" value="Load"

       

      action="#{qtBeanParam.loadTemplate}" immediate="true"

       

      styleClass="blue-button">

       

      </a4j:commandButton>

       

      </h:panelGrid>

       

      </div>