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>
30 * {@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'));
39 Ext.create('Ext.menu.Menu', {
42 floating: false, // usually you want this set to True (default)
43 renderTo: Ext.getBody(), // usually rendered by it's containing component
45 text: 'choose a date',
56 * @author Nicolas Ferrero
58 Ext.define('Ext.menu.DatePicker', {
59 extend: 'Ext.menu.Menu',
61 alias: 'widget.datemenu',
67 <span id='Ext-menu-DatePicker-cfg-hideOnClick'> /**
68 </span> * @cfg {Boolean} hideOnClick
69 * False to continue showing the menu after a date is selected, defaults to true.
73 <span id='Ext-menu-DatePicker-cfg-pickerId'> /**
74 </span> * @cfg {String} pickerId
75 * An id to assign to the underlying date picker. Defaults to <tt>null</tt>.
79 <span id='Ext-menu-DatePicker-cfg-maxHeight'> /**
80 </span> * @cfg {Number} maxHeight
84 <span id='Ext-menu-DatePicker-property-picker'> /**
85 </span> * The {@link Ext.picker.Date} instance for this DateMenu
87 * @type Ext.picker.Date
90 <span id='Ext-menu-DatePicker-event-click'> /**
91 </span> * @event click
95 <span id='Ext-menu-DatePicker-event-itemclick'> /**
96 </span> * @event itemclick
100 initComponent : function(){
104 showSeparator: false,
107 cls: Ext.baseCSSPrefix + 'menu-date-item',
113 me.callParent(arguments);
115 me.picker = me.down('datepicker');
116 <span id='Ext-menu-DatePicker-event-select'> /**
117 </span> * @event select
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();