# Facturas

Con detalles

![](https://2578941663-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6ze2c8GK7mFBZX%2F-Lc1WjGeqF4Ig-44ZLgX%2F-Lc1XA7Sv1ws-n74Jr9G%2Ffa.png?generation=1554820674856770\&alt=media)

**Usar \<p:remotecommand>**

```java
<p:remoteCommand name="onCellEditTable" 
                      process="@this"
                      action="#{facturaController.refresh()}"
                      update=":form:msg,  panelTotales" />
```

**En el datatable usar onCellEdit**

```java
<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>**

```java
   <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**

```java
  <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>
```
