Upgrade to ExtJS 3.3.1 - Released 11/30/2010
[extjs.git] / examples / docs / source / DayHeaderView.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
4   <title>The source code</title>
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 </head>
8 <body  onload="prettyPrint();">
9     <pre class="prettyprint lang-js">/*!
10  * Ext JS Library 3.3.1
11  * Copyright(c) 2006-2010 Sencha Inc.
12  * licensing@sencha.com
13  * http://www.sencha.com/license
14  */
15 <div id="cls-Ext.calendar.DayHeaderView"></div>/**
16  * @class Ext.calendar.DayHeaderView
17  * @extends Ext.calendar.MonthView
18  * <p>This is the header area container within the day and week views where all-day events are displayed.
19  * Normally you should not need to use this class directly -- instead you should use {@link Ext.calendar.DayView DayView}
20  * which aggregates this class and the {@link Ext.calendar.DayBodyView DayBodyView} into the single unified view
21  * presented by {@link Ext.calendar.CalendarPanel CalendarPanel}.</p>
22  * @constructor
23  * @param {Object} config The config object
24  */
25 Ext.calendar.DayHeaderView = Ext.extend(Ext.calendar.MonthView, {
26     // private configs
27     weekCount: 1,
28     dayCount: 1,
29     allDayOnly: true,
30     monitorResize: false,
31
32     <div id="event-Ext.calendar.DayHeaderView-dayclick"></div>/**
33      * @event dayclick
34      * Fires after the user clicks within the day view container and not on an event element
35      * @param {Ext.calendar.DayBodyView} this
36      * @param {Date} dt The date/time that was clicked on
37      * @param {Boolean} allday True if the day clicked on represents an all-day box, else false. Clicks within the 
38      * DayHeaderView always return true for this param.
39      * @param {Ext.Element} el The Element that was clicked on
40      */
41
42     // private
43     afterRender: function() {
44         if (!this.tpl) {
45             this.tpl = new Ext.calendar.DayHeaderTemplate({
46                 id: this.id,
47                 showTodayText: this.showTodayText,
48                 todayText: this.todayText,
49                 showTime: this.showTime
50             });
51         }
52         this.tpl.compile();
53         this.addClass('ext-cal-day-header');
54
55         Ext.calendar.DayHeaderView.superclass.afterRender.call(this);
56     },
57
58     // private
59     forceSize: Ext.emptyFn,
60
61     // private
62     refresh: function() {
63         Ext.calendar.DayHeaderView.superclass.refresh.call(this);
64         this.recalcHeaderBox();
65     },
66
67     // private
68     recalcHeaderBox: function() {
69         var tbl = this.el.child('.ext-cal-evt-tbl'),
70         h = tbl.getHeight();
71
72         this.el.setHeight(h + 7);
73
74         if (Ext.isIE && Ext.isStrict) {
75             this.el.child('.ext-cal-hd-ad-inner').setHeight(h + 4);
76         }
77         if (Ext.isOpera) {
78             //TODO: figure out why Opera refuses to refresh height when
79             //the new height is lower than the previous one
80             //            var ct = this.el.child('.ext-cal-hd-ct');
81             //            ct.repaint();
82             }
83     },
84
85     // private
86     moveNext: function(noRefresh) {
87         this.moveDays(this.dayCount, noRefresh);
88     },
89
90     // private
91     movePrev: function(noRefresh) {
92         this.moveDays( - this.dayCount, noRefresh);
93     },
94
95     // private
96     onClick: function(e, t) {
97         var el = e.getTarget('td', 3),
98             parts,
99             dt;
100         if (el) {
101             if (el.id && el.id.indexOf(this.dayElIdDelimiter) > -1) {
102                 parts = el.id.split(this.dayElIdDelimiter);
103                 dt = parts[parts.length - 1];
104
105                 this.fireEvent('dayclick', this, Date.parseDate(dt, 'Ymd'), true, Ext.get(this.getDayId(dt)));
106                 return;
107             }
108         }
109         Ext.calendar.DayHeaderView.superclass.onClick.apply(this, arguments);
110     }
111 });
112
113 Ext.reg('dayheaderview', Ext.calendar.DayHeaderView);
114 </pre>    
115 </body>
116 </html>