Search code examples
jsfprimefaces

Unable to add "Done" button for PrimeFaces p:calendar


I had a "Done" button in p:calendar when I used PrimeFaces 3

I migrated from 3 to 8, and now the "Done" button is missing in p:calendar.

I tried the following:

<p:calendar id="sdate" value="#{bean.sDate}" size="26" pattern="dd/MM/yyyy HH:mm" showButtonBar="true" buttonBarTemplate="{todayButton} {doneButton}"/>

It is not showing up and when I inspect it is not showing. Note: no CSS/JS included in the page from out side.


Solution

  • Please first some off-topic issues:

    1. PrimeFaces 8 is not the most recent version. The current version is 12, and 13 is around the corner (you can expect a release candidate soon).
    2. Although I didn't find anything about your specific issue, but you should always consult the migration guide when upgrading.
    3. p:calendar is deprecated. It will be replaced by p:datePicker.

    The answer to your question can be found in the documentation. You simply need to set the showButtonPanel to true. The attribute's documentation states:

    Visibility of button panel containing today and done buttons.