source: trunk/web/addons/job_monarch/lib/extjs-30/src/widgets/menu/DateMenu.js @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

  • new ExtJS 3.0
File size: 2.2 KB
Line 
1/*!
2 * Ext JS Library 3.0.0
3 * Copyright(c) 2006-2009 Ext JS, LLC
4 * licensing@extjs.com
5 * http://www.extjs.com/license
6 */
7/**
8 * @class Ext.menu.DateMenu
9 * @extends Ext.menu.Menu
10 * A menu containing a {@link Ext.DatePicker} Component.
11 * @xtype datemenu
12 */
13 Ext.menu.DateMenu = Ext.extend(Ext.menu.Menu, {
14    /**
15     * @cfg {Boolean} enableScrolling
16     * @hide
17     */
18    enableScrolling: false,
19   
20    /**
21     * @cfg {Boolean} hideOnClick
22     * False to continue showing the menu after a date is selected, defaults to true.
23     */
24    hideOnClick: true,
25   
26    /**
27     * @cfg {Number} maxHeight
28     * @hide
29     */
30    /**
31     * @cfg {Number} scrollIncrement
32     * @hide
33     */
34    /**
35     * @property picker
36     * @type DatePicker
37     * The {@link Ext.DatePicker} instance for this DateMenu
38     */
39    cls: 'x-date-menu',
40   
41    /**
42     * @event click
43     * @hide
44     */
45   
46    /**
47     * @event itemclick
48     * @hide
49     */
50
51    initComponent: function(){
52        this.on('beforeshow', this.onBeforeShow, this);
53        if(this.strict = (Ext.isIE7 && Ext.isStrict)){
54            this.on('show', this.onShow, this, {single: true, delay: 20});
55        }
56        Ext.apply(this, {
57            plain: true,
58            showSeparator: false,
59            items: this.picker = new Ext.DatePicker(Ext.apply({
60                internalRender: this.strict || !Ext.isIE,
61                ctCls: 'x-menu-date-item'
62            }, this.initialConfig))
63        });
64        this.picker.purgeListeners();
65        Ext.menu.DateMenu.superclass.initComponent.call(this);
66        this.relayEvents(this.picker, ["select"]);
67        this.on('select', this.menuHide, this);
68        if(this.handler){
69            this.on('select', this.handler, this.scope || this);
70        }
71    },
72
73    menuHide: function() {
74        if(this.hideOnClick){
75            this.hide(true);
76        }
77    },
78
79    onBeforeShow: function(){
80        if(this.picker){
81            this.picker.hideMonthPicker(true);
82        }
83    },
84
85    onShow: function(){
86        var el = this.picker.getEl();
87        el.setWidth(el.getWidth()); //nasty hack for IE7 strict mode
88    }
89 });
90 Ext.reg('datemenu', Ext.menu.DateMenu);
Note: See TracBrowser for help on using the repository browser.