4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-menu-DatePicker'>/**
19 </span> * @class Ext.menu.DatePicker
20 * @extends Ext.menu.Menu
21 * <p>A menu containing an {@link Ext.picker.Date} Component.</p>
22 * <p>Notes:</p><div class="mdetail-params"><ul>
23 * <li>Although not listed here, the <b>constructor</b> for this class
24 * accepts all of the configuration options of <b>{@link Ext.picker.Date}</b>.</li>
25 * <li>If subclassing DateMenu, any configuration options for the DatePicker must be
26 * applied to the <tt><b>initialConfig</b></tt> property of the DateMenu.
27 * Applying {@link Ext.picker.Date DatePicker} configuration settings to
28 * <b><tt>this</tt></b> will <b>not</b> affect the DatePicker's configuration.</li>
29 * </ul></div>
31 * {@img Ext.menu.DatePicker/Ext.menu.DatePicker.png Ext.menu.DatePicker component}
35 * var dateMenu = Ext.create('Ext.menu.DatePicker', {
36 * handler: function(dp, date){
37 * Ext.Msg.alert('Date Selected', 'You choose {0}.', Ext.Date.format(date, 'M j, Y'));
41 * Ext.create('Ext.menu.Menu', {
44 * floating: false, // usually you want this set to True (default)
45 * renderTo: Ext.getBody(), // usually rendered by it's containing component
47 * text: 'choose a date',
53 * text: 'regular item'
57 * @author Nicolas Ferrero
59 Ext.define('Ext.menu.DatePicker', {
60 extend: 'Ext.menu.Menu',
62 alias: 'widget.datemenu',
68 <span id='Ext-menu-DatePicker-cfg-hideOnClick'> /**
69 </span> * @cfg {Boolean} hideOnClick
70 * False to continue showing the menu after a date is selected, defaults to true.
74 <span id='Ext-menu-DatePicker-cfg-pickerId'> /**
75 </span> * @cfg {String} pickerId
76 * An id to assign to the underlying date picker. Defaults to <tt>null</tt>.
80 <span id='Ext-menu-DatePicker-cfg-maxHeight'> /**
81 </span> * @cfg {Number} maxHeight
85 <span id='Ext-menu-DatePicker-property-picker'> /**
86 </span> * The {@link Ext.picker.Date} instance for this DateMenu
88 * @type Ext.picker.Date
91 <span id='Ext-menu-DatePicker-event-click'> /**
92 </span> * @event click
96 <span id='Ext-menu-DatePicker-event-itemclick'> /**
97 </span> * @event itemclick
101 initComponent : function(){
105 showSeparator: false,
108 bodyPadding: 0, // remove the body padding from the datepicker menu item so it looks like 3.3
110 cls: Ext.baseCSSPrefix + 'menu-date-item',
116 me.callParent(arguments);
118 me.picker = me.down('datepicker');
119 <span id='Ext-menu-DatePicker-event-select'> /**
120 </span> * @event select
121 * Fires when a date is selected from the {@link #picker Ext.picker.Date}
122 * @param {Ext.picker.Date} picker The {@link #picker Ext.picker.Date}
123 * @param {Date} date The selected date
125 me.relayEvents(me.picker, ['select']);
127 if (me.hideOnClick) {
128 me.on('select', me.hidePickerOnSelect, me);
132 hidePickerOnSelect: function() {
133 Ext.menu.Manager.hideAll();