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.
这对我有用,外观和感觉还可以:
<p:selectBooleanCheckbox value="#{beanc.value}" onchange="return false;"/>
This is not possible by default. You can disable the checkbox and use css as follows:
<p:selectBooleanCheckbox value="#{bean.value}" disabled="true" styleClass="readonly" />
And the following css so that the box does not appear disabled.
.ui-selectbooleancheckbox.readonly .ui-chkbox-box.ui-state-disabled
{
opacity: 1;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.