1 Reply Latest reply on Feb 2, 2012 6:24 AM by jlpktnst

    rich:autocomplete + a4j:queue/attachQueue

    jlpktnst

      Does this combo work?

       

      I have the queue working on several inputText and other fields, but on autocomplete I cannot get it to work. It would be nice though, since I have to use ajax mode (I only fetch a subset of data since backend is very large).

       

      Now when the user types I will get data fetch for every letter and its visible in suggestion box...

       

      <a4j:queue name="autocompleteQueue" ignoreDupResponses="true" requestDelay="5000" />
      
      <a4j:jsFunction name="submitIdCbtest" action="#{bean.submitCbId}">
       <a4j:param name="id" assignTo="#{bean.cbtest.cbId}"></a4j:param>
      </a4j:jsFunction>
      
      
      <rich:autocomplete value="#{bean.cbtest.desc2}" mode="ajax" minChars="1" style="width: 200px;"
       autocompleteMethod="#{bean.cbtestAutocomplete}" layout="table" var="row" showButton="true"
       fetchValue="#{row.desc2}" onselectitem="postId(event,'data-value-cbtest','data-id-cbtest',submitIdCbtest);" id="cbtestAutocomplete" >
       <rich:column style="width: 200px;">
       <span data-value-cbtest="#{row.cbId}" data-id-cbtest="#{row.desc2}">#{row.desc2}</span>
       </rich:column>
       <a4j:attachQueue name="autocompleteQueue"/>
      </rich:autocomplete>
      
      

       

      postId function just gets the selected id and calls submitIdCbtest function...

       

      This should work imo, the post-id workaround shouldn't interfere. Or at least it seems so to me, but I must be missing something.

       

      I set the delay to an insane length so I can see if its working.

        • 1. Re: rich:autocomplete + a4j:queue/attachQueue
          jlpktnst

          I would really really need something like this... I have a large subset of data and I cannot use cachedAjax mode. And I have some custom logic.

           

          It is quite annoying to see list popup several times loaded with different values during typing.

           

          edit:

           

          <a4j:jsFunction name="submitIdCbtest" action="#{bean.submitCbId}">
           <a4j:param name="id" assignTo="#{bean.cbtest.cbId}"></a4j:param>
          </a4j:jsFunction>
          
          
          <rich:autocomplete value="#{bean.cbtest.desc2}" mode="ajax" minChars="1" style="width: 200px;"
           autocompleteMethod="#{bean.cbtestAutocomplete}" layout="table" var="row" showButton="true"
           fetchValue="#{row.desc2}" onselectitem="postId(event,'data-value-cbtest','data-id-cbtest',submitIdCbtest);" id="cbtestAutocomplete" >
           <rich:column style="width: 200px;">
           <span data-value-cbtest="#{row.cbId}" data-id-cbtest="#{row.desc2}">#{row.desc2}</span>
           </rich:column>
           <a4j:queue ignoreDupResponses="true" requestDelay="1000" />
          </rich:autocomplete>
          
          

           

          This is working I think... should have tried it before. Pay attention to a4j queue position...