Autocomplete con minQueryLength=

Lo usamos cuando deseamos indicar la cantidad de caracteres minimos pàra la busqueda

 <e:autocompletetienda listener="#{tiendaController.handleSelect}"
                                              value="#{choferController.tienda}"

                                              itemLabel=" #{p.tienda}"
                                              field="tienda"
                                              dropdown="false"
                                              minQueryLength="3"
                                              fromstart="true"
                                              />

Componente

<?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">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:composite="http://java.sun.com/jsf/composite"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <composite:interface >


        <composite:attribute name="value" />
         <composite:attribute name="dropdown"  default="false"/>
         <composite:attribute name="minQueryLength"  default="1"/>

        <composite:attribute name="multiple" default="false" />
        <composite:attribute name="itemLabel" />
        <composite:attribute name="update" />
        <composite:attribute name="rendered"/>
         <composite:attribute name="required" default="false" />
        <composite:attribute name="field"/>
         <composite:attribute name="size"  default="25"/>
        <composite:attribute name="listener"  
                             method-signature="void handleSelect(org.primefaces.event.SelectEvent)" />

    </composite:interface>
    <composite:implementation>

        <p:autoComplete     dropdown="#{cc.attrs.dropdown}"    
                            scrollHeight="250"   
                             size="#{cc.attrs.size}"
                             multiple="#{cc.attrs.multiple}" 
                            emptyMessage="#{app['info.nohayregistros']}" 
                            value="#{cc.attrs.value}"  
                            completeMethod="#{tiendaController.tiendaServices.complete}"    
                            var="p"


                             required="#{cc.attrs.required}"
                            itemLabel="#{cc.attrs.itemLabel}"
                            itemValue="#{p}" 
                            forceSelection="true"> 
            <f:converter binding="#{tiendaConverter}"/>
            <f:attribute name="field" value="#{cc.attrs.field}"/>
            <f:attribute name="fielddropdown" value="#{cc.attrs.dropdown}"/>
            <f:attribute name="fieldquerylenth" value="#{cc.attrs.minQueryLength}"/>


            <p:ajax event="itemSelect" listener="#{cc.attrs.listener}"
                    update="#{cc.attrs.update}" />  
            <f:facet name="itemtip">
                <h:panelGrid columns="1" cellpadding="5">

                    <h:outputText value="#{msg['field.idtienda']} #{p.tienda}" />



                </h:panelGrid>
            </f:facet>
        </p:autoComplete>  

    </composite:implementation>

</html>

Services

Last updated

Was this helpful?