<p:autocomplete> JPA con eventos

Pasos:
crear el método complete()
crear método handleSelect()
PAGINA SIN CONTROLAR EL EVENTO
CONTROLANDO EL EVENTO
MOSTRAR DOS COLUMNAS

Last updated
Was this helpful?

crear el método complete()
crear método handleSelect()
PAGINA SIN CONTROLAR EL EVENTO
CONTROLANDO EL EVENTO
MOSTRAR DOS COLUMNAS

Last updated
Was this helpful?
Was this helpful?
public List<Nivel6> complete(String query) {
List<Nivel6> suggestions = new ArrayList<>();
showAll();
for(Nivel6 p : nivel6List) {
if(p.getIdnivel6().startsWith(query))
suggestions.add(p);
}
return suggestions;
}
} public void handleSelect(SelectEvent event) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Selected:" + selected.getNombre(), null);
FacesContext.getCurrentInstance().addMessage(null, message);
}<p:outputLabel value="#{msg.idnivel6}" for="idnivel6" />
<p:autoComplete value="#{nivel6SearchController.selected}" id="basicPojo"
completeMethod="#{nivel6SearchController.complete}"
var="p" itemLabel="#{p.idnivel6}" itemValue="#{p}" converter="nivel6Converter" forceSelection="true"/> <p:outputLabel value="#{msg.idnivel6}" for="idnivel6" />
<p:autoComplete value="#{nivel6SearchController.selected}"
completeMethod="#{nivel6SearchController.complete}"
var="p" itemLabel="#{p.idnivel6}" itemValue="#{p}" converter="nivel6Converter" forceSelection="true">
<p:ajax event="itemSelect" listener="#{nivel6SearchController.handleSelect}" update=":form:growl" />
</p:autoComplete> <p:autoComplete value="#{nivel6SearchController.selected}"
completeMethod="#{nivel6SearchController.complete}"
var="p" itemLabel="#{p.idnivel6} #{p.nombre}" itemValue="#{p}" converter="nivel6Converter" forceSelection="true">
<p:ajax event="itemSelect" listener="#{nivel6SearchController.handleSelect}" update=":form:growl" />
</p:autoComplete>