LOV with Custom autoSuggestBehavior

When we want a LOV with autoSuggest we include a autoSuggestBehavior inside the LOV. But autoSuggestBehavior is only about one field.

<af:inputListOfValues id="jobIdId"
                                    popupTitle="Search and Select: #{bindings.JobId.hints.label}"
                                    value="#{bindings.JobId.inputValue}"
                                    label="#{bindings.JobId.hints.label}"
                                    model="#{bindings.JobId.listOfValuesModel}"
                                    required="#{bindings.JobId.hints.mandatory}"
                                    columns="#{bindings.JobId.hints.displayWidth}"
                                    shortDesc="#{bindings.JobId.hints.tooltip}">
                <f:validator binding="#{bindings.JobId.validator}"/>
                <af:autoSuggestBehavior suggestedItems="#{ bindings.JobId.getSuggestedItems}"/>
              </af:inputListOfValues>

 

We can customize the list of suggested items through own suggestedItems method.

 <af:autoSuggestBehavior suggestedItems="#{MyBean.getSuggestedItems}"/>

In this sample the method(getSuggestedItems) gets a user entry text and calls a method in JobsViewImpl that through ViewCrietria build a suggest item list. In this way we can get records matching with JobId and JobTitle.

See next image:

This approach is also useful for custom the text of suggested items.

You can download the sample here

Note:JDev version 11.1.1.6

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s