1 Reply Latest reply on Sep 20, 2010 3:35 AM by liuliu

    richfaces:suggestionbox + a4j:support -> run twice

    simonc2009

      Hi,

       

      I have a java program which use suggestion box as a editable combo box.

       

      Program works as below

      User click the image and trigger suggestion box to retrieve records from table and then

      use select row record in suggestionbox will trigger fields refresh on other fields.

       

      Problem

      I found program code below will make suggestionbox retrieve records from table run "twice", if I include

      the a4j:support event with the rich:suggestionbox tag.

       

      Note: The a4j:support is used for post event after record selection in suggestion box.

      Code run twice will slow down the program and slow UI response to user.

       

      Would anyone help me to avoid "code" running twice?

       

      Thanks

       

       

      Sample code below

      ==============

      <h:graphicImage
             value="/img/#{bundle.dropDownMouseUp}"      
             onclick="#{rich:component('suggestion')}.callSuggestion(true)"
             rendered="#{crudRights}"
             alt="">                    
      </h:graphicImage>

       

      <rich:suggestionbox id="suggestion" for="acctPeriod" fetchValue="#{acctPeriod.calPer}"
                   height="200"
                   width="150" 
                   minChars="999"                           
                   suggestionAction="#{glCalendarPeriodList.autoComplete}"
                   var="acctPeriod"              
              >
                       <h:column>
                           <h:outputText value="#{acctPeriod.calPer}" />
                       </h:column>
                       <h:column>
                           <h:outputText value="#{acctPeriod.pk.acctPer}" />
                       </h:column> 

                    
                       <a:support event="onselect"     <------------------------ code here make suggestionbox retrieving record from table twice                          
                        reRender="calendarMonth, jrnlGenNo"
                        action="#{glJvEntry.getNewJrnlGenNo(glJrnlVchrMast)}"
                           actionListener="#{glJrnlVchrMast.statusListener}"/>                       

      </rich:suggestionbox>