Loading ...
Sorry, an error occurred while loading the content.

RE: [ydn-javascript] Calendar: Disable individual date cells

Expand Messages
  • Satyen Desai
    Hi, You can use Calendar s custom renderer infrastructure for this: Here s an example (you can modify the look of the disabled dates through CSS):
    Message 1 of 2 , Feb 4, 2008
    • 0 Attachment
      Hi,
      You can use Calendar's custom renderer infrastructure for this:

      Here's an example (you can modify the look of the disabled dates through
      CSS): http://developer.yahoo.com/yui/examples/calendar/render.html

      However, performance does become a factor depending on how many
      non-clickable cells you have. If you have a lot of dates with custom
      renderers applied, performance will not be good.

      Here's a solution which helps address the performance impact, providing
      pretty much constant rendering time, regardless of how many custom
      rendered dates you have (it'll take a few seconds to load because it
      compares a fast solution with a slow one):

      http://yuiblog.com/sandbox/yui/v241/examples/calendar/rendererPerformanc
      e.html

      You should be able to modify the "performs well" implementation to
      determine whether the date has an event or not, and apply the custom
      rendering code to make the cell selectable or non-selectable.

      Another approach which you can combine with the above for optimal
      performance, is to over-ride the default renderers Calendar uses for
      selectable cells, as shown in this example* :

      http://yuiblog.com/sandbox/yui/v241/examples/calendar/readOnlyCalendar.h
      tml

      So you're only using custom renderers to "re-enable" cells with events
      in them (assuming you have way more non-selectable cells, than
      selectable cells).

      Hope that helps,
      Satyen

      * NOTE: In your case, you'll probably want to hold onto the original
      renderCellDefault, styleCellDefault functions, so you can reuse them to
      re-nable selectable cells. Hence extending the Calendar, or simply
      backing up the original renderers before you over-ride them would be a
      good idea.
    Your message has been successfully submitted and would be delivered to recipients shortly.