4 Replies Latest reply on Jan 2, 2017 4:11 AM by michpetrov

    Display Event Information on Date in rich:calendar

    asimshaikh1

      Hello everyone,

      previously also I have posted this issue. I just want to display a event column with date.

       

      <rich:calendar mode="ajax" boundaryDatesMode="scroll" styleClass="#{eventMaster.eventMasterList!=null and eventMaster.eventMasterList.size()>0?'postive-records':'no-records'}" locale="EN"  id="searchDateCalendarcommon" popup="false"  showApplyButton="false" datePattern="dd/MM/yyyy"   value="#{eventMaster.eventSearchDate}" >

      <f:ajax event="change" listener="#{commonOutputContentBean.showEvents()}" render="cmnoplayoutfrm searchDateCalendarcommon" />

      </rich:calendar>.

      I have tried with datamodel but no luck.

      .postive-records .rf-cal-sel { background-color: green; }  .no-records .rf-cal-sel { background-color: red; } 

      public class MyCalendarModel implements CalendarDataModel {

       
      private boolean hasEvents(Calendar calendar) {
        
      // …
        
      }

        
      @Override
        
      public CalendarDataModelItem[] getData(Date[] dateArray) {
        
      CalendarDataModelItem[] modelItems = new MyCalendarModelItem[dateArray.length];
        
      Calendar current = GregorianCalendar.getInstance();
        
      Calendar today = GregorianCalendar.getInstance();
        today
      .setTime(new Date());
        
      CalendarModelItem modelItem;
        
      for (int i = 0; i < dateArray.length; i++) {
        current
      .setTime(dateArray[i]);
        modelItem
      = new MyCalendarModelItem();
        
      if (hasEvents(current)) {
        modelItem
      .setStyleClass("postive-records");
        
      } else {
        modelItem
      .setStyleClass("no-records");
        
      }
        modelItems
      [i] = modelItem;
        
      }
        
      return modelItems;
        
      }

        
      @Override
        
      public Object getToolTip(Date date) {
        
      return null;
        
      }
      }

      WHAT CODE TO WRITE IN HASEVENT I DONT UNDERSTAND. kindly help.