1 Reply Latest reply on Aug 10, 2007 4:32 AM by ilya_shaikovsky

    Problem with rich:suggestionbox

    vsirishreddy

      Hi...

      I am using richfaces 3.0.0 with Sun RI 1.0. I am trying to configure suggestion box by first trying out the sample application from the following link:

      http://livedemo.exadel.com/richfaces-demo/richfaces/suggestionBox.jsf;jsessionid=BC864E30B480A7D5F5D783B9DD027FC7?c=suggestionBox

      When I enter a value "a" or "A", I could see that the event is being fired to the backing bean method and that returns me 31 records. Problem here being, even though the records are being fetched, the suggestion box is not being displayed on the screen.

      My JSF code:

      <h:inputText value="#{suggestionBox.property}" id="text" />
      <rich:suggestionbox id="suggestionBoxId" for="text" tokens=",["
       rules="#{suggestionBox.rules}"
       suggestionAction="#{suggestionBox.autocomplete}" var="result"
       fetchValue="#{result.text}" rows="#{suggestionBox.intRows}"
       first="#{suggestionBox.intFirst}"
       minChars="#{suggestionBox.minchars}"
       shadowOpacity="#{suggestionBox.shadowOpacity}"
       border="#{suggestionBox.border}" width="#{suggestionBox.width}"
       height="#{suggestionBox.height}"
       shadowDepth="#{suggestionBox.shadowDepth}"
       cellpadding="#{suggestionBox.cellpadding}">
       <h:column>
       <h:outputText value="#{result.text}" />
       </h:column>
      </rich:suggestionbox>


      My backing bean action class:

      public List autocomplete(Object suggest) {
       String pref = (String)suggest;
       ArrayList result = new ArrayList();
       System.out.println("pref::"+pref);
       Iterator iterator = getAllData().iterator();
       while (iterator.hasNext()) {
       Data elem = (Data) iterator.next();
       if ((elem != null && elem.getText().toLowerCase().indexOf(pref.toLowerCase()) == 0) || "".equals(pref))
       {
       result.add(elem);
       }
       }
       System.out.println("size::"+result.size());
       //This gives me size::31 on console
       return result;
      }


      My faces-config.xml:

      <managed-bean>
       <managed-bean-name>suggestionBox</managed-bean-name>
       <managed-bean-class>backingbeans.SuggestionBean</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>


      I am not sure where exactly I am messing it up. Any help would be highly appreciated.

      Sirish