jsfprimefacesprimefaces-datatable

Primefaces Datatable: how to default select a checkbox which is disabled


I have a datatable and a particular row's checkbox is disabled. But it is not showing as selected. I want to show it as selected by default though it is disabled default.

Please help me how to do that.

If I remove the below from dataTable, then its selected by default, but of course its not disabled. disabledSelection="#{value == 'AAA'}"

I verified the value in selectedArray. It is present even the row is disabled. selection="#{bean.selectedArray}"


Solution

  • I assume you are using PrimeFaces 14? This was done on purpose: https://github.com/primefaces/primefaces/issues/11356

    Basically if a row is marked as disabled the component does not respect its checked/unchecked value as its disabled and should be completely ignored by the server side.