With PF 3.4, this solution will be:
- Keep opacity 1.0 in the read-only input field (i.e., not dim opacity with disabled = true);
- Remove the Datepicker class from the field;
- Disable events from the field.
(1) Create a function:
function setCalendarVis(readOnly) { if(readOnly) $('input:text').removeClass('hasDatepicker').unbind(); }
(2) Define the calendar component:
<p:calendar readonly="#{bean.readonly}" value="#{bean.datefield}" mode="popup"/>
(3) Call the function, for example, perhaps through the ajax event on p: databable:
<p:ajax event="rowDblselect" update="@form" oncomplete="setCalendarVis(#{bean.readonly});"/>
My application uses different styles for reading and writing: 
My use of unbind () is rather brute force. You can refine it to cancel only certain events.
Fire suit on!
source share