I'm using PrimeFaces 5.0.
What I'm trying to do is with the help of the 1p:autocomplete1 look on the BD, returning suggestions and using itemtip show some other information need it, everything seem to work well, the problem is that when I get the data and selected, this data is not setting it on the property...
autocomplete with the itemtip:
<p:row>
<p:column colspan="10">
<p:outputLabel value="Orden de Compra "/>
<p:autoComplete id="itemTip" value="#{c_ordenCompra.encabezado_encontrado}"
completeMethod="#{c_ordenCompra.completarOrdenCpra}"
var="orden" itemLabel="#{orden.numdocucv}" itemValue="#{orden.idencacv}"
converter="themeConverter" forceSelection="true">
<f:facet name="itemtip">
<h:panelGrid columns="2" cellpadding="3" cellspacing="5">
<h:outputText value="Fecha" />
<h:outputText value="#{orden.fechadoctocv}" />
<h:outputText value="Sucursal" />
<h:outputText value="#{orden.tbsucursalesByFkencacvsucurentra.nomsucur}" />
<h:outputText value="Proveedor" />
<h:outputText value="#{orden.tbpersonasrelaByIdpersorelaprove.nomcompleto}" />
</h:panelGrid>
</f:facet>
</p:autoComplete>
<p:commandButton value="buscar" actionListener="#{c_ordenCompra.seleccionarorden()}"/>
</p:column>
</p:row>
Here is the converter I'm trying to use. (I made some test here and everything seems to work.)
public class converterOC implements Converter {
public Object getAsObject(FacesContext fc, UIComponent uic, String value) {
if (value != null && value.trim().length() > 0) {
try {
M_encacv modelo_encacv = new M_encacv();
Tbencacv encav_encontrado = modelo_encacv.Ordene1CompraEncacv(value);
return encav_encontrado;
} catch (NumberFormatException e) {
throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Conversion Error", "Not a valid theme."));
}
} else {
return null;
}
}
public String getAsString(FacesContext fc, UIComponent uic, Object object) {
if (object != null) {
return String.valueOf(object);
} else {
return null;
}
}
Entity:
public class Tbencacv implements java.io.Serializable {
private int idencacv;
private Tbbancos tbbancos;
private Tbbodegas tbbodegasByFkencacvbodesalida;
private Tbbodegas tbbodegasByFkencacvbodeentra;
private Tbcajasvta tbcajasvta;
private Tbcajerosvta tbcajerosvta;
private Tbcias tbcias;
private Tbencainven tbencainven;
private Tbpersonasrela tbpersonasrelaByIdpersorelaprove;
private Tbpersonasrela tbpersonasrelaByIdpersorelaemple;
private Tbpersonasrela tbpersonasrelaByIdpersorelacliente;
private Tbsucursales tbsucursalesByFkencacvsucurentra;
private Tbsucursales tbsucursalesByFkencacvsucursalida;
private Tbterminoscv tbterminoscv;
private Tbtiposmovicv tbtiposmovicv;
private Tbvendecobra tbvendecobra;
private Date fechadoctocv;
private String observagralcv;
private String concepcontagralcv;
private Double valortotalcv;
private Double valorivacv;
private Double valorimpuperecv;
private Double valorexencv;
private Double valorgravacv;
private Double valornosujecv;
private Double valorfovialcv;
private Double porcedescuv;
private String procedecv;
private char cpravta;
private Double valorrentacv;
private int numdocucv;
private char autorizadocucv;
private Date fechablc;
private Character aplicalibroiva;
private Double valorefectivo;
private Double valortarjeta;
private Double valorcheque;
private Integer numcheque;
private String numreserva;
private String numbaucher;
private String numaprobacion;
private Character importacion;
private Character sujetoexcluido;
private Character retentercero;
private String direccionenviar;
private String nomclientedocu;
private Double valorcredito;
private Integer codprove;
private String nomvencob;
private Integer codcliente;
private Integer codemple;
private Character movcerrado;
private Character afectaexisten;
private Character docucvimpre;
private Character paraconsu;
private Character parainven;
private Character paracl;
private String nomuser;
private Set<Tbdetacv> tbdetacvs = new HashSet<Tbdetacv>(0);
public Tbencacv() {
}
//all setters and getters
In the same row as the autocomplete I have a commandbutton. It is suppose to print on console one data from the property I had set on the autocomplete, but it shows nothing.
public void seleccionarorden() {
System.out.println(getEncabezado_encontrado().getValorivacv());
System.out.println(Encabezado_encontrado.getValorivacv());
}
I tried everything it comes to my mind, but I ran out of ideas
This is what the console show. Not even an exception: