I have a requirement to disable a primeface tree (checkbox selection mode) for some occasions.User should be able to see selected as well as un-selected checboxes, but they need to be disabled in this occasion. Does anybody know how to do it? Iam using PF 4
You can set for node userNode.setSelectable(false) and in jsf treetable add
showUnselectableCheckbox="true"
I found a solution for this. But is not elegant, this can be done with css, We can add a conditional css to the tree and make it unclickable.
.not-clickable {
cursor: not-allowed;
pointer-events: none;
}
Used above css style in the tree with a condition,
<p:tree id="tree" styleClass="#{not backingBean.editable?'not-clickable':''}" cache="false" value="#{backingBean.treeRoot}" var="node" selectionMode="checkbox" selection="#{backingBean.selectedValuesNodes}">
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