I am currently using a <p:selectBooleanCheckbox />
and I was wondering if there is a way to make it read only.
Basically, I would like you to be able to make it open up a sublist of check boxes and the original checkbox would only show the checkmark if any of the other checkboxes are checked.
Any ideas on how to do this?
<p:selectBooleanCheckbox value="#{formBean.value1}" disabled="true"/>
This will disable the element. I used to change CSS by primeface skinning if required.
Bind the property with some Boolean variable in manage bean. Refresh/ Reload the component on completion of the event [ according to the requirement ] that is changing the Boolean variable.
Setting
disabled="true"
solves the issue, that this checkbox cannot be edited anymore, but it is very pale, and it's look-and feel don't conform page style. I used the following trick to make this like an ordinary (not disabled) component:
$(document).ready(function(){
$('.ui-chkbox div').removeClass('ui-state-disabled');
});
This removes "disabled" style from all primefaces checkboxes on the page. You can easily adjust it only to the components you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With