1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
<div id="cls-Ext.menu.DateMenu"></div>/**
* @class Ext.menu.DateMenu
* @extends Ext.menu.Menu
* <p>A menu containing an {@link Ext.DatePicker} Component.</p>
* <p>Notes:</p><div class="mdetail-params"><ul>
* <li>Although not listed here, the <b>constructor</b> for this class
* accepts all of the configuration options of <b>{@link Ext.DatePicker}</b>.</li>
* <li>If subclassing DateMenu, any configuration options for the DatePicker must be
* applied to the <tt><b>initialConfig</b></tt> property of the DateMenu.
* Applying {@link Ext.DatePicker DatePicker} configuration settings to
* <b><tt>this</tt></b> will <b>not</b> affect the DatePicker's configuration.</li>
* </ul></div>
* @xtype datemenu
*/
Ext.menu.DateMenu = Ext.extend(Ext.menu.Menu, {
<div id="cfg-Ext.menu.DateMenu-enableScrolling"></div>/**
* @cfg {Boolean} enableScrolling
* @hide
*/
enableScrolling : false,
<div id="cfg-Ext.menu.DateMenu-handler"></div>/**
* @cfg {Function} handler
* Optional. A function that will handle the select event of this menu.
* The handler is passed the following parameters:<div class="mdetail-params"><ul>
* <li><code>picker</code> : DatePicker<div class="sub-desc">The Ext.DatePicker.</div></li>
* <li><code>date</code> : Date<div class="sub-desc">The selected date.</div></li>
* </ul></div>
*/
<div id="cfg-Ext.menu.DateMenu-scope"></div>/**
* @cfg {Object} scope
* The scope (<tt><b>this</b></tt> reference) in which the <code>{@link #handler}</code>
* function will be called. Defaults to this DateMenu instance.
*/
<div id="cfg-Ext.menu.DateMenu-hideOnClick"></div>/**
* @cfg {Boolean} hideOnClick
* False to continue showing the menu after a date is selected, defaults to true.
*/
hideOnClick : true,
<div id="cfg-Ext.menu.DateMenu-pickerId"></div>/**
* @cfg {String} pickerId
* An id to assign to the underlying date picker. Defaults to <tt>null</tt>.
*/
pickerId : null,
<div id="cfg-Ext.menu.DateMenu-maxHeight"></div>/**
* @cfg {Number} maxHeight
* @hide
*/
<div id="cfg-Ext.menu.DateMenu-scrollIncrement"></div>/**
* @cfg {Number} scrollIncrement
* @hide
*/
<div id="prop-Ext.menu.DateMenu-picker"></div>/**
* The {@link Ext.DatePicker} instance for this DateMenu
* @property picker
* @type DatePicker
*/
cls : 'x-date-menu',
<div id="event-Ext.menu.DateMenu-click"></div>/**
* @event click
* @hide
*/
<div id="event-Ext.menu.DateMenu-itemclick"></div>/**
* @event itemclick
* @hide
*/
initComponent : function(){
this.on('beforeshow', this.onBeforeShow, this);
if(this.strict = (Ext.isIE7 && Ext.isStrict)){
this.on('show', this.onShow, this, {single: true, delay: 20});
}
Ext.apply(this, {
plain: true,
showSeparator: false,
items: this.picker = new Ext.DatePicker(Ext.applyIf({
internalRender: this.strict || !Ext.isIE,
ctCls: 'x-menu-date-item',
id: this.pickerId
}, this.initialConfig))
});
this.picker.purgeListeners();
Ext.menu.DateMenu.superclass.initComponent.call(this);
<div id="event-Ext.menu.DateMenu-select"></div>/**
* @event select
* Fires when a date is selected from the {@link #picker Ext.DatePicker}
* @param {DatePicker} picker The {@link #picker Ext.DatePicker}
* @param {Date} date The selected date
*/
this.relayEvents(this.picker, ['select']);
this.on('show', this.picker.focus, this.picker);
this.on('select', this.menuHide, this);
if(this.handler){
this.on('select', this.handler, this.scope || this);
}
},
menuHide : function() {
if(this.hideOnClick){
this.hide(true);
}
},
onBeforeShow : function(){
if(this.picker){
this.picker.hideMonthPicker(true);
}
},
onShow : function(){
var el = this.picker.getEl();
el.setWidth(el.getWidth()); //nasty hack for IE7 strict mode
}
});
Ext.reg('datemenu', Ext.menu.DateMenu);
</pre>
</body>
</html>
|