0 Replies Latest reply on Aug 27, 2009 11:09 AM by indyjones

    Help with rich:region vs rich:outputPanel

      Here is my problem....

      I have a h:selectOneMenu that is populated by a database query. When the page is rendered it hits the database and retrieves the items.

      Within this h:selectOneMenu I have a a4j:support that re-renders a rich:pickList when a value is changed.

      This works fine, BUT....

      When I first come to the page, according to the logs, the rich:pickList is rendered twice.

      Also, when I select something in the h:selectOneMenu, it re-queries for the data that already populates the h:selectOneMenu.

      So....

      PROBLEM #1
      ---------------
      When the page is first rendered, why does the rich:pickList get rendered twice? How do I set it up so it only renders once.

      PROBLEM #2
      ---------------
      What can I add to make sure when a value is selected in the h:selectOneMenu, that it only renders the rich:pickList and doesn't query the database again for values for the h:selectOneMenu?

      CODE

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j"
       template="../layout/template.xhtml">
      
       <ui:define name="body">
      
       <h:form enctype="multipart/form-data">
      
       <h:selectOneMenu id="selMenServiceProviders"
       value="#{getserviceproviderfeatures.serviceProvider}" >
      
      
       <s:selectItems value="#{getserviceproviders.serviceProviders}"
       var="sp"
       label="#{sp.name}"
       noSelectionLabel="Please select Service Provider...."/>
      
       <s:convertEntity />
      
       <a4j:support event="onchange"
       reRender="pklstFeatures" />
      
       </h:selectOneMenu>
      
       <rich:pickList id="pklstFeatures"
       value="#{getserviceproviderfeatures.serviceProvider.features}"
       >
      
       <s:selectItems value="#{getserviceproviderfeatures.serviceProviderFeaturesBW}"
       var="f"
       label="#{f.name}"/>
      
       <s:convertEntity />
      
       </rich:pickList>
      
      
       </h:form>
      
       </ui:define>
      
      </ui:composition>


      I have tried rich:regions and rich:outputPanels and cant figure it out....

      Any help would be really appreciated.....