4 Replies Latest reply on Sep 2, 2013 5:44 AM by moshebeeri

    rich:autocomplete mode="ajax" is not working.

    moshebeeri

      I am trying to use autocomplete ajax mode with no success,

      the problem seems to be in the client view, the dropbox is not been populated.

      the response seems OK and it works with client mode.

      I am using RichFaces 4 with JSF 2.1.

       

      this is the client side code:

       

      <h:form>
          <rich:panel header="other auto-completion">
              <rich:autocomplete autocompleteMethod="#{autoComplete.autocomplete}"
                                 autocompleteList="#{autoComplete.locations}"
                                 mode="ajax"
                                 showButton="true"
                                 layout="table"
                                 var="data"
                                 fetchValue="#{data.name}"
                                 id="tag_names"
                                 value="#{tagCollector.tagName}">
                  <rich:column>#{data.name}</rich:column>
                  <rich:column>#{data.objid}</rich:column>
              </rich:autocomplete>
          </rich:panel>
      </h:form>
      
        • 1. Re: rich:autocomplete mode="ajax" is not working.
          bleathem

          What specific version of RichFaces are you using?

           

          Have you compared your code to the showcase example:

          http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=autocomplete

           

          If you still can't get it to work after comparing closely with the showcase example, please post the accompanying backing-bean code to your facelet sample.

          • 2. Re: rich:autocomplete mode="ajax" is not working.
            moshebeeri

            Hi Brian,

             

            Thanks for your suggestion,

            in fact I did compare the code over and over, as it was the source I learn prior to implementing.

            I have investigated this even further this client send request to server and receives answer that is not been rendered to a DropDownBox

            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:a4j="http://richfaces.org/a4j"
              xmlns:rich="http://richfaces.org/rich">
            
              <f:view>
              <h:head>
              </h:head>
              <h:body>
                 <h:form>
              <rich:panel header="Rich auto-completion">
              <rich:autocomplete
              autocompleteMethod="#{autoComplete.autocomplete}"
              mode="ajax"
              showButton="true"
              layout="table"
              var="data"
              fetchValue="#{data.name}"
              id="tag_names"
              value="#{tagCollector.tagName}">
              <rich:column>
              #{data.name}
              </rich:column>
              <rich:column>
              #{data.objid}
              </rich:column>
              </rich:autocomplete>
              </rich:panel>
                 </h:form>
              </h:body>
              </f:view>
            </ui:composition>
            

            the response is:

            richautocomplete.png

            received but not been populating the drop down box.

             

            Is I am using the client mode as such:

             

            <rich:panel header="Rich auto-completion">
              <rich:autocomplete
                  autocompleteList="#{autoComplete.locations}"
                  mode="client"
                  showButton="true"
                  layout="table"
                  var="data"
                  fetchValue="#{data.name}"
                  id="tag_names"
                  value="#{tagCollector.tagName}">
                <rich:column>
                  #{data.name}
                </rich:column>
                <rich:column>
                  #{data.objid}
                </rich:column>
              </rich:autocomplete>
            </rich:panel>
            

             

            then I do get the client DropDown populated but the data is rendered on the server side (I concluded from not seen request in the networking)

            richautocomplete2.png

            Since I would like to provide auto complete to the whole English dictionary (218K) and more professional terms then I really need the Ajax solution

            but the issue is that the ajax response is not been displayed to the user.

            I think it is client side issue I am using Ubuntu 13.04 desktop with chrome and FF, JSF 2.1 RichFaces 4 and MyFaces 2.1 with tomcat 7 oracle java 7 sdk.

            Any help will be welcome.

            • 3. Re: rich:autocomplete mode="ajax" is not working.
              lfryc

              Hey moshe,

               

              I wonder whether there is any error with the update, please try to use a4j:log approach mentioned here:

              https://gist.github.com/lfryc/6123495

               

              I can see that response contains some "suggestions", but the suggestion box is never updated, is that right?

              If there would be any error in updating the DOM or widget, RichFaces would show it in a a4j:log.

              • 4. Re: rich:autocomplete mode="ajax" is not working.
                moshebeeri

                Hi Lukas,

                 

                Thanks for the suggestion, I will do it over the next couple of days, in order to try to help the fix of this problem.

                For the mean while I found that it is working with JSF 2.1.25 , so my code was OK. I will change it back to 2.2.2 and post the log to help a bit in debugging.

                 

                BTW a4j:log is a very good tip, certainly useful!