Facturas
Last updated
Was this helpful?
Last updated
Was this helpful?
Con detalles
Usar <p:remotecommand>
<p:remoteCommand name="onCellEditTable"
process="@this"
action="#{facturaController.refresh()}"
update=":form:msg, panelTotales" />
En el datatable usar onCellEdit
<p:ajax event="cellEdit" listener="#{facturaController.onCellEdit}"
oncomplete="onCellEditTable()"
update=":form:msg, datatable panelTotales"
/>
En las columnas para artículos usamos <p:autocomplete> con <p:cellEditor>
<p:column headerText="#{msg['field.idarticulo']}" style="width:95px;">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{item.articulo.codigo}" title="#{msg['field.disponible']}: #{item.cantidademisor}"/></f:facet>
<f:facet name="input">
<e:autocompletearticulo listener="#{facturaController.onArticuloChange(rowIndex,item,'factura')}"
value="#{item.articulo}"
itemLabel=" #{p.codigo}"
minQueryLength="4"
field="codigo"
update=" datatable"/>
</f:facet>
</p:cellEditor>
</p:column>
En la columna para la cantidad, en el inputText. agregamos el update y el onblur
<p:column headerText="#{msg['field.cantidad']}" style="width:45px;">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{item.cantidad}" title="#{msg['field.disponible']}: #{item.cantidademisor}" /></f:facet>
<f:facet name="input">
<b:inputText value="#{item.cantidad}" title="#{msg['field.disponible']}: #{item.cantidademisor}"
onblur="#{facturaController.refresh}"
update=":form:msg, form:datatable form:panelTotales"/>
</f:facet>
</p:cellEditor>
</p:column>