Sunday, June 15, 2014

Columnas editables en un datatable con primefaces

Utilizar <p:cellEditor>, y un facet name=”output” para mostrar la salida mediante un  <p:outputLabel> y un     <f:facet name="input"> donde usaremos un <p:inputText> para obtener los datos de entrada.
<p:ajax event="cellEdit" listener="#{pagosfijosSearchController.onCellEdit}" update=":form:growl,:form:datatableImpuestos" />

<p:column>
                               <f:facet name="header">
                                   <p:outputLabel value="#{msg.exoneracion}"/>
                               </f:facet>
                               <p:cellEditor>  
                                   <f:facet name="output">
                                       <p:outputLabel value="#{item.exoneracion}" >
                                            <f:convertNumber type="number" locale="Locale.US" groupingUsed="true" minFractionDigits="2" pattern="#0.00"/>
                                       </p:outputLabel>
                                   </f:facet>
                                 
                                   <f:facet name="input">
                                       <p:inputText value="#{item.exoneracion}" >
                                                    <f:convertNumber type="number" locale="Locale.US" groupingUsed="true" minFractionDigits="2" pattern="#0.00"/>
                                       </p:inputText>
                                   </f:facet>  
                               </p:cellEditor>  

                           </p:column>

No comments: