Upgrade to ExtJS 3.3.0 - Released 10/06/2010
[extjs.git] / examples / calendar / src / templates / DayHeaderTemplate.js
1 /*!
2  * Ext JS Library 3.3.0
3  * Copyright(c) 2006-2010 Ext JS, Inc.
4  * licensing@extjs.com
5  * http://www.extjs.com/license
6  */
7 /**
8  * @class Ext.calendar.DayHeaderTemplate
9  * @extends Ext.XTemplate
10  * <p>This is the template used to render the all-day event container used in {@link Ext.calendar.DayView DayView} and 
11  * {@link Ext.calendar.WeekView WeekView}. Internally the majority of the layout logic is deferred to an instance of
12  * {@link Ext.calendar.BoxLayoutTemplate}.</p> 
13  * <p>This template is automatically bound to the underlying event store by the 
14  * calendar components and expects records of type {@link Ext.calendar.EventRecord}.</p>
15  * <p>Note that this template would not normally be used directly. Instead you would use the {@link Ext.calendar.DayViewTemplate}
16  * that internally creates an instance of this template along with a {@link Ext.calendar.DayBodyTemplate}.</p>
17  * @constructor
18  * @param {Object} config The config object
19  */
20 Ext.calendar.DayHeaderTemplate = function(config){
21     
22     Ext.apply(this, config);
23     
24     this.allDayTpl = new Ext.calendar.BoxLayoutTemplate(config);
25     this.allDayTpl.compile();
26     
27     Ext.calendar.DayHeaderTemplate.superclass.constructor.call(this,
28         '<div class="ext-cal-hd-ct">',
29             '<table class="ext-cal-hd-days-tbl" cellspacing="0" cellpadding="0">',
30                 '<tbody>',
31                     '<tr>',
32                         '<td class="ext-cal-gutter"></td>',
33                         '<td class="ext-cal-hd-days-td"><div class="ext-cal-hd-ad-inner">{allDayTpl}</div></td>',
34                         '<td class="ext-cal-gutter-rt"></td>',
35                     '</tr>',
36                 '</tobdy>',
37             '</table>',
38         '</div>'
39     );
40 };
41
42 Ext.extend(Ext.calendar.DayHeaderTemplate, Ext.XTemplate, {
43     applyTemplate : function(o){
44         return Ext.calendar.DayHeaderTemplate.superclass.applyTemplate.call(this, {
45             allDayTpl: this.allDayTpl.apply(o)
46         });
47     }
48 });
49
50 Ext.calendar.DayHeaderTemplate.prototype.apply = Ext.calendar.DayHeaderTemplate.prototype.applyTemplate;