I placed a p:selectBooleanCheckbox
inside a p:dataTable
in a JSF project.
When the cell is selected the check box floats to the right. I know it's a css thing but i'm not sure how to fix it.
<p:cellEditor>
<f:facet name="output">
<p:selectBooleanCheckbox id="hasUserOutputCheckBox" value="#{customerBean.selectedReference.hasUser}"/>
</f:facet>
<f:facet name="input">
<p:selectBooleanCheckbox id="hasUserInputCheckBox" value="#{customerBean.selectedReference.hasUser}"/>
</f:facet>
</p:cellEditor>
The issue is that the editable table cell has a padding of
1rem
(PrimeFaces 10, Saga theme) in output mode, but a padding of0
in input mode. This is caused by the rule:You can fix this difference by adding a padding of
1rem
to your checkbox in input mode.Tested with:
Result:
Note that the actual padding you need to use might depend on the PrimeFaces version and the theme you are using. So, check the actual padding first using your browser's debugging tools.
See also: