Problem with validators and inCell editing

UI Components for JSF
Post Reply
Ryoga
Posts: 8
Joined: 30 Jul 2009, 02:59

26 Aug 2011, 17:08

Hello everyone!

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>
What I'm trying to do is validate the third column value against the value of the second one. The thid column's value must be bewteen 0.00 and the value of the second column. But when I click the button to close the edit cell mode, the validations says that the value is not between the exptected values of 0.00 and 0.00. I can see the right value being rendered in the second column, but somehow is being evaluated to 0.00 in the validator's maximum value.

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

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 23 guests