Richfaces Charts Minimum and Maximum Timing

My problem is that the RichFaces calendar limits the dates that should be selected by the user.

Suppose I want the user to be able to select only the dates of this month and the dates of the next month.

I used the preloadDateRangeStart and preloadDateRangeEnd attributes, but did nothing.

I created my own CalendarDataModel, which uses preloadDateRangeStart and preloadDateRangeEnd and allows items, but the calendar on the screen allows you to select only the dates of the current month. Please note that preloadDateRangeStart today is date and preloadDateRangeEnd today is plus plus 2 months.

I definitely missed something. Can someone help me?

+6
jsf richfaces
source share
2 answers

Use the isDayEnabled="isDayEnabled" attribute, where the value ( isDayEnabled ) is the javascript function you must define in the form

 function isDayEnabled(day) { } 

See richfaces demo for more details.

If you want to add server-side validation, use a custom JSF validator or use Validator Validator annotations (see richfaces - bean validator)

+3
source share

I figured out how this works, so here it is:

I created a class that implements CalendarDataModel .

I did not use the preloadDateRangeStart and preloadDateRangeEnd , though, since CalendarDataModel only cares about the range between preloadDateRangeStart and preloadDateRangeEnd if you specify them.

My CalendarDataModel disables calendar items whose date is outside the date range that I specified in the properties file, and which I use in CalendarDateModel to determine if there is an item date between the range to disable it.

So now it works great. Here is the tag:

 <a4j:outputPanel id="myCal" layout="block"> <rich:calendar cellHeight="30px" cellWidth="30px" dataModel="#{MyCalendarDataModel}" datePattern="dd/MM/yyyy" mode="ajax" style="width:200px" value="#{MyPage.theDate}"/> </a4j:outputPanel> 

I also tried your solution. It works, but it is a bit messy on the client.

Thanks again to the man

+1
source share

All Articles