DEV Community

aristides villarreal
aristides villarreal

Posted on

Error con < p:selectBooleanCheckbox /> en datatable < p:cellEditor />

Para corregir el comportamiento de un un selectBooleanCheckBox en un datatable editable mediante p:cellEditor recurrimos a algo muy simple.

  • Utilizar un elemento hthml de tipo checbox.

Agregar un css para establecer el alto y ancho del componente

 <style type="text/css">
 input.htmlCheckbox {
            width: 20px;
            height: 20px;
        }
</style>
Enter fullscreen mode Exit fullscreen mode

Ahora en el datatable

<p:column headerText="#{msg['field.active']}">
    <p:cellEditor >
         <f:facet name="output">
                                              <p:selectBooleanCheckbox value="#{item.active}" readonly="true"/>
         </f:facet>

         <f:facet name="input">
           <input type="checkbox" jsf:value="#{item.active}"                                                       
                  class="htmlCheckbox"/>                                                                            


         </f:facet>


    </p:cellEditor >
 </p:column>

Enter fullscreen mode Exit fullscreen mode

Top comments (0)