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

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay