9 Replies Latest reply on Dec 6, 2007 11:26 PM by manishsjain

    Setting holidays in the rich:calendar

    manishsjain

      Hi,

      How do it set custom holidays in the rich calendar other than the weekend dates (sat/sun). I would like to set 25 December, 1 January etc also similar to weekend dates.

      Please help.

        • 1. Re: Setting holidays in the rich:calendar
          ilya_shaikovsky

          you may use two approaches

          in ajax mode or using preloads - you may provide - dataModel which should return classes for every day

          Or you may use JS function which will return styleClass name to the day. In this case you'll be need to implement the function which will return this class for given date, but you'l' be also responsible for saving this state on server side if you need.

          • 2. Re: Setting holidays in the rich:calendar
            tjakopec

            Yes, it would be nice to have some list off additional dates that are like sat/sun. attribute name will be highlitedDates and it will be a List. Somewhere in ours backing beans we set that list.

            I now there is already boundaryDatesMode, but highlitedDates (holidayDates) should also be implemented!

            • 3. Re: Setting holidays in the rich:calendar
              ilya_shaikovsky

              You could implement any styles/content/disablement using dataModel

              • 4. Re: Setting holidays in the rich:calendar
                manishsjain

                Thanks for quick response.
                Any example or sample code snippet will be real helpful

                • 5. Re: Setting holidays in the rich:calendar
                  ilya_shaikovsky

                  you may check it from developers samples. isntructions in wiki.

                  • 6. Re: Setting holidays in the rich:calendar
                    manishsjain

                    Hi,

                    I have added following code


                    public CalendarDataModelItem[] getData(Date[] dateArray) {
                    if (dateArray == null) {
                    return null;
                    }

                    CalendarDataModelItem[] items = new CalendarDataModelItem[dateArray.length];
                    for (int i = 0; i < dateArray.length; i++) {
                    System.out.println("item is:"+ dateArray);
                    items
                    = createDataModelItem(dateArray);
                    System.out.println("item is:"+ items
                    .getStyleClass());
                    }

                    return items;
                    }

                    protected CalendarDataModelItem createDataModelItem(Date date) {
                    CalendarDataModelItemImpl item = new CalendarDataModelItemImpl();

                    System.out.println("the day is:"+date.getDay());
                    if(date.getDay() > 3)
                    item.setStyleClass("rich-calendar-weekends");
                    item.setData(date);


                    return item;
                    }

                    But on the screen i cannot see the particular date getting rendered as per the spcecified style class. If I see the source it shows the proper style class on dates but they are not rendered.

                    Am i missing something? Please help

                    • 7. Re: Setting holidays in the rich:calendar
                      _jmax_

                      I would like to set a style class for holidays.
                      Is it possible to see code snippets with the 2 approaches:

                      you may use two approaches

                      in ajax mode or using preloads - you may provide - dataModel which should return classes for every day

                      Or you may use JS function which will return styleClass name to the day. In this case you'll be need to implement the function which will return this class for given date, but you'l' be also responsible for saving this state on server side if you need.


                      Thanks

                      • 8. Re: Setting holidays in the rich:calendar
                        manishsjain

                        I tried both the alternates suggested but it seems not to work. Whenever i set the syle class for any particular date it sets for all the days in that month

                        [img][/img]

                        • 9. Re: Setting holidays in the rich:calendar
                          manishsjain

                          Can any body from developer community help on this? This is becoming really problemetic for the project work.