Set checkbox as read

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;"/>
链接地址: http://www.djcxy.com/p/11754.html

上一篇: 加载Android应用程序加载屏幕背景图片需要很长时间

下一篇: 将复选框设置为已读