3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
8 * @class Ext.menu.DateMenu
\r
9 * @extends Ext.menu.Menu
\r
10 * <p>A menu containing an {@link Ext.DatePicker} Component.</p>
\r
11 * <p>Notes:</p><div class="mdetail-params"><ul>
\r
12 * <li>Although not listed here, the <b>constructor</b> for this class
\r
13 * accepts all of the configuration options of <b>{@link Ext.DatePicker}</b>.</li>
\r
14 * <li>If subclassing DateMenu, any configuration options for the DatePicker must be
\r
15 * applied to the <tt><b>initialConfig</b></tt> property of the DateMenu.
\r
16 * Applying {@link Ext.DatePicker DatePicker} configuration settings to
\r
17 * <b><tt>this</tt></b> will <b>not</b> affect the DatePicker's configuration.</li>
\r
21 Ext.menu.DateMenu = Ext.extend(Ext.menu.Menu, {
\r
23 * @cfg {Boolean} enableScrolling
\r
26 enableScrolling : false,
\r
28 * @cfg {Function} handler
\r
29 * Optional. A function that will handle the select event of this menu.
\r
30 * The handler is passed the following parameters:<div class="mdetail-params"><ul>
\r
31 * <li><code>picker</code> : DatePicker<div class="sub-desc">The Ext.DatePicker.</div></li>
\r
32 * <li><code>date</code> : Date<div class="sub-desc">The selected date.</div></li>
\r
36 * @cfg {Object} scope
\r
37 * The scope (<tt><b>this</b></tt> reference) in which the <code>{@link #handler}</code>
\r
38 * function will be called. Defaults to this DateMenu instance.
\r
41 * @cfg {Boolean} hideOnClick
\r
42 * False to continue showing the menu after a date is selected, defaults to true.
\r
47 * @cfg {String} pickerId
\r
48 * An id to assign to the underlying date picker. Defaults to <tt>null</tt>.
\r
53 * @cfg {Number} maxHeight
\r
57 * @cfg {Number} scrollIncrement
\r
61 * The {@link Ext.DatePicker} instance for this DateMenu
\r
65 cls : 'x-date-menu',
\r
77 initComponent : function(){
\r
78 this.on('beforeshow', this.onBeforeShow, this);
\r
79 if(this.strict = (Ext.isIE7 && Ext.isStrict)){
\r
80 this.on('show', this.onShow, this, {single: true, delay: 20});
\r
84 showSeparator: false,
\r
85 items: this.picker = new Ext.DatePicker(Ext.applyIf({
\r
86 internalRender: this.strict || !Ext.isIE,
\r
87 ctCls: 'x-menu-date-item',
\r
89 }, this.initialConfig))
\r
91 this.picker.purgeListeners();
\r
92 Ext.menu.DateMenu.superclass.initComponent.call(this);
\r
95 * Fires when a date is selected from the {@link #picker Ext.DatePicker}
\r
96 * @param {DatePicker} picker The {@link #picker Ext.DatePicker}
\r
97 * @param {Date} date The selected date
\r
99 this.relayEvents(this.picker, ['select']);
\r
100 this.on('select', this.menuHide, this);
\r
102 this.on('select', this.handler, this.scope || this);
\r
106 menuHide : function() {
\r
107 if(this.hideOnClick){
\r
112 onBeforeShow : function(){
\r
114 this.picker.hideMonthPicker(true);
\r
118 onShow : function(){
\r
119 var el = this.picker.getEl();
\r
120 el.setWidth(el.getWidth()); //nasty hack for IE7 strict mode
\r
123 Ext.reg('datemenu', Ext.menu.DateMenu);
\r