3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class Ext.menu.DatePicker
17 * @extends Ext.menu.Menu
18 * <p>A menu containing an {@link Ext.picker.Date} Component.</p>
19 * <p>Notes:</p><div class="mdetail-params"><ul>
20 * <li>Although not listed here, the <b>constructor</b> for this class
21 * accepts all of the configuration options of <b>{@link Ext.picker.Date}</b>.</li>
22 * <li>If subclassing DateMenu, any configuration options for the DatePicker must be
23 * applied to the <tt><b>initialConfig</b></tt> property of the DateMenu.
24 * Applying {@link Ext.picker.Date DatePicker} configuration settings to
25 * <b><tt>this</tt></b> will <b>not</b> affect the DatePicker's configuration.</li>
28 * {@img Ext.menu.DatePicker/Ext.menu.DatePicker.png Ext.menu.DatePicker component}
32 * var dateMenu = Ext.create('Ext.menu.DatePicker', {
33 * handler: function(dp, date){
34 * Ext.Msg.alert('Date Selected', 'You choose {0}.', Ext.Date.format(date, 'M j, Y'));
38 * Ext.create('Ext.menu.Menu', {
41 * floating: false, // usually you want this set to True (default)
42 * renderTo: Ext.getBody(), // usually rendered by it's containing component
44 * text: 'choose a date',
50 * text: 'regular item'
54 * @author Nicolas Ferrero
56 Ext.define('Ext.menu.DatePicker', {
57 extend: 'Ext.menu.Menu',
59 alias: 'widget.datemenu',
66 * @cfg {Boolean} hideOnClick
67 * False to continue showing the menu after a date is selected, defaults to true.
72 * @cfg {String} pickerId
73 * An id to assign to the underlying date picker. Defaults to <tt>null</tt>.
78 * @cfg {Number} maxHeight
83 * The {@link Ext.picker.Date} instance for this DateMenu
85 * @type Ext.picker.Date
98 initComponent : function(){
102 showSeparator: false,
105 bodyPadding: 0, // remove the body padding from the datepicker menu item so it looks like 3.3
107 cls: Ext.baseCSSPrefix + 'menu-date-item',
113 me.callParent(arguments);
115 me.picker = me.down('datepicker');
118 * Fires when a date is selected from the {@link #picker Ext.picker.Date}
119 * @param {Ext.picker.Date} picker The {@link #picker Ext.picker.Date}
120 * @param {Date} date The selected date
122 me.relayEvents(me.picker, ['select']);
124 if (me.hideOnClick) {
125 me.on('select', me.hidePickerOnSelect, me);
129 hidePickerOnSelect: function() {
130 Ext.menu.Manager.hideAll();