calendar: skinning for next day, next week
I have a usecase where the calendar has to be integrated in my web page.
The page should contain buttons 'prev day', 'next day', 'prev week',
When those buttons are clicked, I need to highlight that corresponding
cell/row in the calendar. I would like to know whether YUI calendar
provides such api with which we can skin a particular week/day.
If anyone has a working example, that would be very helpful.
Thanks in advance.
- Hi Shafi,
When you say highlight, are these days "selected" dates, or would you
need to maintain some other state collection for these days, different
from the Calendar's selected state?
1). If they are selected, you can use the cell index based API methods
to select cells in the Calendar, based on index math [ currentCellIndex
- 1, currentCellIndex + 1 ]:
Here's an example (older code base, but the API remains the same), which
uses cell indices to select dates:
Alternatively, you can also calculate the date range, and pass the dates
to the Calendar's select method.
2). If these are not going to be "selected" cells, you can use the
renderer infrastructure to apply custom classes to your "special" cells:
Hope that helps,
p.s. If you're going to end up with a lot of renderers, you can use this
technique to improve performance: