4 Replies Latest reply on Apr 18, 2011 10:16 AM by Edilmar Alves

    RichFaces4 autocomplete - missing properties

    Edilmar Alves Expert

      Hi,

       

      I would like to know what the new properties for autocomplete that implement something like suggestionBox:

      - styleClass => inputClass?

      - width => how to define the size of the field?

      - is it possible to implement a f:converter from a database lookup?

      - rows => how to define max rows to display?

      - nothingValue => string to display when no data is returned

      - columnClasses

        • 1. RichFaces4 autocomplete - missing properties
          Rocky S Master

          - nothingValue => string to display when no data is returned

           

          use a custom filter-

           

          <script>

          function customFilter(subString, value){

          if(subString.length>=1) {

          if(value.indexOf(subString)!=-1)

          return true;

          }else return false;

          };

          </script>

          <h:form>

          <rich:autocomplete mode="client" minChars="0" autofill="false"

          clientFilter="customFilter"

          autocompleteMethod="#{autocompleteBean.autocomplete}" />

          </h:form>

           

           

          If now row is returned call its javascript api function, setValue("No suggestions") or you may want to alert popup saying now rows.

           

           

           

          - columnClasses

          this is not table here, you don't need it.

           

          - rows => how to define max rows to display?

          inside your autocomplete method, define the limit for the number of results returned.

           

          - width => how to define the size of the field?

          .rf-au-fld This class defines styles for the auto-complete field. override this css class to provide the width

           

           

          - styleClass => inputClass?

          .rf-au-tbl

          This class defines styles

          for a table in the autocomplete

          box.

          • 2. Re: RichFaces4 autocomplete - missing properties
            Edilmar Alves Expert

            Hi,

             

            I tried to override ".rf-au-fld" but nothinh occurs.

            This is my simple code:

             

            <?xml version='1.0' encoding='UTF-8' ?>

            <!DOCTYPE html 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: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"

                            template="/WEB-INF/templates/templateTeste.xhtml"

                            >

              <ui:define name="content">

                <style type="text/css">

                  .rf-au-fld { width: 10px !important; }

                </style>

                    <h:form id="form">

                        <rich:autocomplete mode="cachedAjax" minChars="2" showButton="true"

                            autocompleteMethod="#{teste.autocomplete}" />

                    </h:form>

              </ui:define>

            </ui:composition>

             

            Other doubt about this: if I need an autocomplete with a width and other with different width, how could I do?

            • 3. Re: RichFaces4 autocomplete - missing properties
              Ilya Shaikovsky Master

              1) you could use popupClass and inputClass. I checked and them works.

               

              unfortunatelly stlyleClass not works and I will create issue for that. http://jira.jboss.org/browse/RF-10931

               

              2) if want to use rf-* classes there are next ones to be used:

               

              rf-au - wrapper

              rf-au-inp - input

               

              could use selectors by id for example (or by parent component class as styleClass for autocomplete not works)

              • 4. Re: RichFaces4 autocomplete - missing properties
                Edilmar Alves Expert

                if I need an autocomplete with a width and other with different width, how could I do? Because rf-* classes define the same config for all components in the page.