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

calendar cell attributes

Expand Messages
  • alexander.brill
    Hi, I ve been trying to add my own cell renderer for a calendar: var unAvailableRenderer = function(workingDate, cell) { title = This date is unavailable ;
    Message 1 of 2 , Sep 26, 2008
    • 0 Attachment
      Hi,

      I've been trying to add my own cell renderer for a calendar:

      var unAvailableRenderer = function(workingDate, cell) {
      title = "This date is unavailable";
      cell.setAttribute("title", title);
      cell.innerHTML = workingDate.getDate();
      YAHOO.util.Dom.addClass(cell, "unavailable");
      return YAHOO.widget.Calendar.STOP_RENDER;
      }

      And I register it with:
      cal.addRenderer(date, unAvailableRenderer);

      However, even though unAvailableRenderer is called only on one cell (I
      check this by using console.log(cell)) the title attribute is set for
      every cell in the calendar following workingDate. I'm a bit a miss
      about what's going on here. Any insights?

      Alexander
      http://blog.brill.no
    • alexander.brill
      ... I ended up solving this by creating a global var to keep all the cells I wanted to set the title for (unAvailableRenderer does this). Then iterating over
      Message 2 of 2 , Sep 30, 2008
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "alexander.brill" <alex@...> wrote:
        >
        > Hi,
        >
        > I've been trying to add my own cell renderer for a calendar:
        >
        > var unAvailableRenderer = function(workingDate, cell) {
        > title = "This date is unavailable";
        > cell.setAttribute("title", title);
        > cell.innerHTML = workingDate.getDate();
        > YAHOO.util.Dom.addClass(cell, "unavailable");
        > return YAHOO.widget.Calendar.STOP_RENDER;
        > }
        >
        > And I register it with:
        > cal.addRenderer(date, unAvailableRenderer);
        >
        > However, even though unAvailableRenderer is called only on one cell (I
        > check this by using console.log(cell)) the title attribute is set for
        > every cell in the calendar following workingDate. I'm a bit a miss
        > about what's going on here. Any insights?
        >


        I ended up solving this by creating a global var to keep all the cells
        I wanted to set the title for (unAvailableRenderer does this). Then
        iterating over them and calling setAttribute before the calendars
        render() method is called.

        Alexander Brill
        http://brill.no
      Your message has been successfully submitted and would be delivered to recipients shortly.