X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..6e39d509471fe9b4e2660e0d1631b350d0c66f40:/src/widgets/menu/DateMenu.js?ds=sidebyside diff --git a/src/widgets/menu/DateMenu.js b/src/widgets/menu/DateMenu.js index 3a879f11..5d90742f 100644 --- a/src/widgets/menu/DateMenu.js +++ b/src/widgets/menu/DateMenu.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.0.0 + * Ext JS Library 3.1.0 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license @@ -7,7 +7,15 @@ /** * @class Ext.menu.DateMenu * @extends Ext.menu.Menu - * A menu containing a {@link Ext.DatePicker} Component. + *
A menu containing an {@link Ext.DatePicker} Component.
+ *Notes:
picker
: DatePickerdate
: Date{@link #handler}
+ * function will be called. Defaults to this DateMenu instance.
+ */
/**
* @cfg {Boolean} hideOnClick
* False to continue showing the menu after a date is selected, defaults to true.
*/
- hideOnClick: true,
+ hideOnClick : true,
+
+ /**
+ * @cfg {String} pickerId
+ * An id to assign to the underlying date picker. Defaults to null.
+ */
+ pickerId : null,
/**
* @cfg {Number} maxHeight
@@ -32,11 +58,11 @@
* @hide
*/
/**
+ * The {@link Ext.DatePicker} instance for this DateMenu
* @property picker
* @type DatePicker
- * The {@link Ext.DatePicker} instance for this DateMenu
*/
- cls: 'x-date-menu',
+ cls : 'x-date-menu',
/**
* @event click
@@ -48,7 +74,7 @@
* @hide
*/
- initComponent: function(){
+ 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});
@@ -56,35 +82,44 @@
Ext.apply(this, {
plain: true,
showSeparator: false,
- items: this.picker = new Ext.DatePicker(Ext.apply({
+ items: this.picker = new Ext.DatePicker(Ext.applyIf({
internalRender: this.strict || !Ext.isIE,
- ctCls: 'x-menu-date-item'
+ ctCls: 'x-menu-date-item',
+ id: this.pickerId
}, this.initialConfig))
});
this.picker.purgeListeners();
Ext.menu.DateMenu.superclass.initComponent.call(this);
- this.relayEvents(this.picker, ["select"]);
+ /**
+ * @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() {
+ menuHide : function() {
if(this.hideOnClick){
this.hide(true);
}
},
- onBeforeShow: function(){
+ onBeforeShow : function(){
if(this.picker){
this.picker.hideMonthPicker(true);
}
},
- onShow: function(){
+ onShow : function(){
var el = this.picker.getEl();
el.setWidth(el.getWidth()); //nasty hack for IE7 strict mode
}
});
- Ext.reg('datemenu', Ext.menu.DateMenu);
\ No newline at end of file
+ Ext.reg('datemenu', Ext.menu.DateMenu);
+
\ No newline at end of file