I have a datatable with dynamicly generated data from a database. The user is able to select/unselect rows but only these which are not set as mustSelect from the database.
My Bean
public boolean isDisabled () {
if (evState == EvaluationState.MUST_EVALUATE) {
return true;
} else {
return false;
}
}
public boolean isChecked() {
if (evState == EvaluationState.EVALUATE
|| evState == EvaluationState.MUST_EVALUATE) {
return true;
} else {
return false;
}
}
and my xhtmlCode:
< p:selectBooleanCheckbox value=”#{myBean.checked}” disabled = “#{myBean.disabled }”/>
which is currently not working like I want it. All check boxes are selected. At compile time I don´t know which check box will enabled or not that’s why I have the method disabled.
I would be very happy if someone has a solution how to set disabled dynamically.
Your model should contain 2 attributes to handle these operations, not your controller.
The view
in that way, every row has its own checked and disabled data value.