1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-menu.DatePicker'>/**
2 </span> * @class Ext.menu.DatePicker
3 * @extends Ext.menu.Menu
4 * <p>A menu containing an {@link Ext.picker.Date} Component.</p>
5 * <p>Notes:</p><div class="mdetail-params"><ul>
6 * <li>Although not listed here, the <b>constructor</b> for this class
7 * accepts all of the configuration options of <b>{@link Ext.picker.Date}</b>.</li>
8 * <li>If subclassing DateMenu, any configuration options for the DatePicker must be
9 * applied to the <tt><b>initialConfig</b></tt> property of the DateMenu.
10 * Applying {@link Ext.picker.Date DatePicker} configuration settings to
11 * <b><tt>this</tt></b> will <b>not</b> affect the DatePicker's configuration.</li>
12 * </ul></div>
13 * {@img Ext.menu.DatePicker/Ext.menu.DatePicker.png Ext.menu.DatePicker component}
15 var dateMenu = Ext.create('Ext.menu.DatePicker', {
16 handler: function(dp, date){
17 Ext.Msg.alert('Date Selected', 'You choose {0}.', Ext.Date.format(date, 'M j, Y'));
22 Ext.create('Ext.menu.Menu', {
25 floating: false, // usually you want this set to True (default)
26 renderTo: Ext.getBody(), // usually rendered by it's containing component
28 text: 'choose a date',
39 * @author Nicolas Ferrero
41 Ext.define('Ext.menu.DatePicker', {
42 extend: 'Ext.menu.Menu',
44 alias: 'widget.datemenu',
50 <span id='Ext-menu.DatePicker-cfg-hideOnClick'> /**
51 </span> * @cfg {Boolean} hideOnClick
52 * False to continue showing the menu after a date is selected, defaults to true.
56 <span id='Ext-menu.DatePicker-cfg-pickerId'> /**
57 </span> * @cfg {String} pickerId
58 * An id to assign to the underlying date picker. Defaults to <tt>null</tt>.
62 <span id='Ext-menu.DatePicker-cfg-maxHeight'> /**
63 </span> * @cfg {Number} maxHeight
67 <span id='Ext-menu.DatePicker-property-picker'> /**
68 </span> * The {@link Ext.picker.Date} instance for this DateMenu
70 * @type Ext.picker.Date
73 <span id='Ext-menu.DatePicker-event-click'> /**
74 </span> * @event click
78 <span id='Ext-menu.DatePicker-event-itemclick'> /**
79 </span> * @event itemclick
83 initComponent : function(){
90 cls: Ext.baseCSSPrefix + 'menu-date-item',
96 me.callParent(arguments);
98 me.picker = me.down('datepicker');
99 <span id='Ext-menu.DatePicker-event-select'> /**
100 </span> * @event select
101 * Fires when a date is selected from the {@link #picker Ext.picker.Date}
102 * @param {Ext.picker.Date} picker The {@link #picker Ext.picker.Date}
103 * @param {Date} date The selected date
105 me.relayEvents(me.picker, ['select']);
107 if (me.hideOnClick) {
108 me.on('select', me.hidePickerOnSelect, me);
112 hidePickerOnSelect: function() {
113 Ext.menu.Manager.hideAll();
115 });</pre></pre></body></html>