View Full Version : Ext.menu.DateMenu equalent

25 Feb 2011, 2:54 AM
I want a datemenu to drop down from a button button click, in extjs 3 I used Ext.menu.DateMenu is there somethin similar in extjs 4. I tryed using Ext.picker.Date, but was unable to use it directly as a menu for the button.

Any suggestions?

25 Feb 2011, 10:13 AM
Yes, Ext.picker.Date, although floatable (as all Components are in Ext 4) is lacking the "showBy" method.

In fact, this should be hoisted into the Component class in 4.0 because Components may be configured floating: true

I'll fix that.

In the meantime, you can borrow the method. configure your Button with

menu: new Ext.picker.Date({
floating: true,
showBy: Ext.menu.Menu.prototype.showBy

And ensure you are using ext-all(-debug).js because there's a bug in Ext.date.Picker's definition: it won't inherit day names and month names correctly.

I'll fix all these things for the next release.

25 Feb 2011, 11:52 AM
Actually, that will pop up the DatePicker, but that won't then disappear if you click outside of it.

The correct solution is

menu: {
border: false,
items: new Ext.picker.Date()

The missing border on the DatePicker has been fixed here ready for next release.

28 Feb 2011, 11:28 PM
I tried your code, but get this error: item.on is not a function
Tried to remove the param items, but stil got the error, so the problem must be the menu object

1 Mar 2011, 8:59 AM

text: 'Date',
menu: {
border: false,
items: {
xtype: 'datepicker'

Gives this for me


1 Mar 2011, 10:00 AM
oh, just found out, i didnt call parent initComponent after setting the menu in initComponent

Now it works