jsf - Disable specific dates on p:calendar -
is possible disable specific dates (for example: 15th may or 23rd june) on primefaces 3.5 <p:calendar>
component? there min , max, need disable specific dates public holidays using el expressions can use dynamic dates.
using hieu's answer, make sure dates disable have no leading zeros in front (eg. '03/03/2013' should '3/3/2013').
step 1: write javascript function disable list of dates
var disableddays = ["5-15-2013", "6-23-2013"]; function disableallthesedays(date) { var m = date.getmonth(), d = date.getdate(), y = date.getfullyear(); (i = 0; < disableddays.length; i++) { if($.inarray((m+1) + '-' + d + '-' + y,disableddays) != -1) { return [false]; } } return [true]; }
step 2: use beforeshowday
attribute of primefaces datepicker
<p:calendar id="pfdate" navigator="true" pattern="mm-dd-yyyy" value="#{day}" beforeshowday="disableallthesedays" showon="button"/>
Comments
Post a Comment