GUI Components JavaScript DHTML




  Yahoo! Calendar Control - Custom Renderer Example
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
    YAHOO.namespace("example.calendar");
    YAHOO.example.calendar.renderHoliday = function(workingDate, cell) {
      YAHOO.util.Dom.addClass(cell, "holiday");
    }
    function init() {
      YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("YAHOO.example.calendar.cal1","cal1Container","1/2006");
      YAHOO.example.calendar.cal1.addRenderer("12/25,1/1", YAHOO.example.calendar.renderHoliday);
      YAHOO.example.calendar.cal1.render();
    }
    YAHOO.util.Event.addListener(window, "load", init);
  


  
  
  
    

Calendar Control


  

  
    

Holiday Renderer Implementation


    

Here is an example of how to create renderers to format specific holidays with a special style:



var cal1;
var renderHoliday = function(workingDate, cell) {
  YAHOO.util.Dom.addClass(cell, "holiday");
}
function init() {
  cal1 = new YAHOO.widget.Calendar("cal1","cal1Container");
  cal1.addRenderer("12/25,1/1", renderHoliday);
  cal1.render();
}

    

    
    
      
      

      
        reset|
        what's selected?
      
    
  

 
dp.SyntaxHighlighter.HighlightAll('code'); 



           
         
  
yui.zip( 3,714 k)