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

Yahoo! UI Calendar addrender function - add content to cells

Expand Messages
  • Arclyte
    Hello, I ve just begun playing around with the Yahoo! UI widgets. I m trying to use the calendar system to plug into an events table in our database so that I
    Message 1 of 2 , Apr 27, 2006
    • 0 Attachment
      Hello,

      I've just begun playing around with the Yahoo! UI widgets. I'm trying
      to use the calendar system to plug into an events table in our
      database so that I can have our events be calendar driven. I'm trying
      to do things like change styles (background colors or hover events,
      etc) and insert content into a calendar cell (on holidays or vacation
      days, etc). I can't seem to figure out how to do it though. From
      what I can tell, I should be using the addrenderer function on
      whatever cells I want to add content to, and have that function
      specify the innerHTML of the element. But how do I reference the cells
      in that function? I've got the idea of the cells array, but I'm still
      not sure how values are stored in this array and how I can point to
      various dates... Thanks for any advice on this topic.

      -Jim
    • Steven Peterson
      Jim, You reference the cells using the cell parameter of your render function. For instance: var cal1; var renderCellHoliday = function(workingDate, cell) {
      Message 2 of 2 , Apr 27, 2006
      • 0 Attachment

        Jim,

         

        You reference the cells using the cell parameter of your render function. For instance:

         

                    var cal1;

         

                    var renderCellHoliday = function(workingDate, cell) {

                          cell.innerHTML = "";

                          cell.appendChild(document.createTextNode("H"));

                          return YAHOO.widget.Calendar_Core.STOP_RENDER;

                    }

         

                    function init() {

                          cal1 = new YAHOO.widget.Calendar("cal1","cal1Container");

                          cal1.addRenderer("12/25,1/1", renderCellHoliday);

                          cal1.render();

                    }

         

        This example renders Christmas and New Year’s with the letter H. This should get you started. If you have any trouble, please let me know!

         

        Steven Peterson

        Web Developer, Platform Engineering

        Yahoo!


        From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Arclyte
        Sent: Thursday, April 27, 2006 1:37 PM
        To: ydn-javascript@yahoogroups.com
        Subject: [ydn-javascript] Yahoo! UI Calendar addrender function - add content to cells

         

        Hello,

        I've just begun playing around with the Yahoo! UI widgets.  I'm trying
        to use the calendar system to plug into an events table in our
        database so that I can have our events be calendar driven.  I'm trying
        to do things like change styles (background colors or hover events,
        etc) and insert content into a calendar cell (on holidays or vacation
        days, etc).  I can't seem to figure out how to do it though.  From
        what I can tell, I should be using the addrenderer function on
        whatever cells I want to add content to, and have that function
        specify the innerHTML of the element. But how do I reference the cells
        in that function?  I've got the idea of the cells array, but I'm still
        not sure how values are stored in this array and how I can point to
        various dates...  Thanks for any advice on this topic.

        -Jim




      Your message has been successfully submitted and would be delivered to recipients shortly.