I'm using PrimeFaces 2.2.1, Mojarra 2.1.0-b11, and GlassFish 3.1.
I'm trying to implement inCell editing, but I'm having some problems getting my validators to work.
The code I'm using is this:
Code: Select all
<p:growl id="detallesGrowl" />
<h:panelGrid id="panelDetalles" width="100%">
<p:fieldset legend="${msg.comprobanteFiscal_detalles}"
collapsed="#{facturaEditForm.detailsCollapsed}" toggleable="true"
toggleListener="#{facturaEditForm.handleDetailsToggle}">
<p:dataTable value="#{conceptos}" var="conceptoComprobante"
emptyMessage="${msg.search_empty}"
rowEditListener="#{facturaEditForm.conceptoEditListener}"
onRowEditUpdate="detallesGrowl">
<!-- Inicia columna de cantidad -->
<p:column headerText="${msg.conceptoComprobante_cantidad}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{conceptoComprobante.cantidad}" />
</f:facet>
<f:facet name="input">
<p:inputText id="cantidad" required="true" maxlength="20"
value="#{conceptoComprobante.cantidad}"
styleClass="auto {mNum: 10, mDec: 0}"
onfocus="loadAutonumeric()" converter="#{cantidadConverter}">
<f:validateLongRange minimum="1" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<!-- Termina columna de cantidad -->
<p:column headerText="${msg.conceptoComprobante_importeBruto}">
<h:outputText value="#{conceptoComprobante.importeBruto}"
converter="#{importeConverter}" />
</p:column>
<!-- Inicia columna de descuento -->
<p:column headerText="${msg.conceptoComprobante_descuento}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{conceptoComprobante.descuento}"
converter="#{importeConverter}" />
</f:facet>
<f:facet name="input">
<p:inputText id="descuento"
label="#{msg.conceptoComprobante_descuento}" maxlength="20"
value="#{conceptoComprobante.descuento}"
styleClass="auto {aSign: '$', mNum: 17}"
onfocus="loadAutonumeric()" converter="#{importeConverter}">
<f:validateDoubleRange minimum="0.00"
maximum="#{conceptoComprobante.importeBruto}" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<!-- Termina columna de descuento -->
<p:column id="edit">
<p:rowEditor />
</p:column>
</p:dataTable>
</p:fieldset>
</h:panelGrid>
Anyone knows how can I make this work? If I can't use validators this way, could I validate the row in the rowEditListener and do not allow the cell edit mode to close until it fulfills the validation?
Hope you can help me.
Thank you!
Aram