3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.menu.DateMenu"></div>/**
\r
9 * @class Ext.menu.DateMenu
\r
10 * @extends Ext.menu.Menu
\r
11 * <p>A menu containing an {@link Ext.DatePicker} Component.</p>
\r
12 * <p>Notes:</p><div class="mdetail-params"><ul>
\r
13 * <li>Although not listed here, the <b>constructor</b> for this class
\r
14 * accepts all of the configuration options of <b>{@link Ext.DatePicker}</b>.</li>
\r
15 * <li>If subclassing DateMenu, any configuration options for the DatePicker must be
\r
16 * applied to the <tt><b>initialConfig</b></tt> property of the DateMenu.
\r
17 * Applying {@link Ext.DatePicker DatePicker} configuration settings to
\r
18 * <b><tt>this</tt></b> will <b>not</b> affect the DatePicker's configuration.</li>
\r
22 Ext.menu.DateMenu = Ext.extend(Ext.menu.Menu, {
\r
23 <div id="cfg-Ext.menu.DateMenu-enableScrolling"></div>/**
\r
24 * @cfg {Boolean} enableScrolling
\r
27 enableScrolling : false,
\r
28 <div id="cfg-Ext.menu.DateMenu-handler"></div>/**
\r
29 * @cfg {Function} handler
\r
30 * Optional. A function that will handle the select event of this menu.
\r
31 * The handler is passed the following parameters:<div class="mdetail-params"><ul>
\r
32 * <li><code>picker</code> : DatePicker<div class="sub-desc">The Ext.DatePicker.</div></li>
\r
33 * <li><code>date</code> : Date<div class="sub-desc">The selected date.</div></li>
\r
36 <div id="cfg-Ext.menu.DateMenu-scope"></div>/**
\r
37 * @cfg {Object} scope
\r
38 * The scope (<tt><b>this</b></tt> reference) in which the <code>{@link #handler}</code>
\r
39 * function will be called. Defaults to this DateMenu instance.
\r
41 <div id="cfg-Ext.menu.DateMenu-hideOnClick"></div>/**
\r
42 * @cfg {Boolean} hideOnClick
\r
43 * False to continue showing the menu after a date is selected, defaults to true.
\r
47 <div id="cfg-Ext.menu.DateMenu-maxHeight"></div>/**
\r
48 * @cfg {Number} maxHeight
\r
51 <div id="cfg-Ext.menu.DateMenu-scrollIncrement"></div>/**
\r
52 * @cfg {Number} scrollIncrement
\r
55 <div id="prop-Ext.menu.DateMenu-picker"></div>/**
\r
56 * The {@link Ext.DatePicker} instance for this DateMenu
\r
60 cls : 'x-date-menu',
\r
62 <div id="event-Ext.menu.DateMenu-click"></div>/**
\r
67 <div id="event-Ext.menu.DateMenu-itemclick"></div>/**
\r
72 initComponent : function(){
\r
73 this.on('beforeshow', this.onBeforeShow, this);
\r
74 if(this.strict = (Ext.isIE7 && Ext.isStrict)){
\r
75 this.on('show', this.onShow, this, {single: true, delay: 20});
\r
79 showSeparator: false,
\r
80 items: this.picker = new Ext.DatePicker(Ext.apply({
\r
81 internalRender: this.strict || !Ext.isIE,
\r
82 ctCls: 'x-menu-date-item'
\r
83 }, this.initialConfig))
\r
85 this.picker.purgeListeners();
\r
86 Ext.menu.DateMenu.superclass.initComponent.call(this);
\r
87 <div id="event-Ext.menu.DateMenu-select"></div>/**
\r
89 * Fires when a date is selected from the {@link #picker Ext.DatePicker}
\r
90 * @param {DatePicker} picker The {@link #picker Ext.DatePicker}
\r
91 * @param {Date} date The selected date
\r
93 this.relayEvents(this.picker, ['select']);
\r
94 this.on('select', this.menuHide, this);
\r
96 this.on('select', this.handler, this.scope || this);
\r
100 menuHide : function() {
\r
101 if(this.hideOnClick){
\r
106 onBeforeShow : function(){
\r
108 this.picker.hideMonthPicker(true);
\r
112 onShow : function(){
\r
113 var el = this.picker.getEl();
\r
114 el.setWidth(el.getWidth()); //nasty hack for IE7 strict mode
\r
117 Ext.reg('datemenu', Ext.menu.DateMenu);
\r