PDA

View Full Version : DateField closes the parent Menu



ntulip
22 Jul 2009, 8:00 AM
I am having an issue where a DateField's calendar icon closes the whole parent menu when selected.

Not sure what why or how to stop it from doing that. Anyone have any ideas? Here is the config code. The two DateFields are at the bottom of the config.

The structure is currently: Toolbar -> SpitButton -> Menu -> Items


var tb = new Ext.Toolbar({ cls: '' });
tb.render("placeholder");

tb.add(
{
text: 'Welcome ' + userObject.name,
xtype: 'label'
}, '-',
{
text: 'Today is ' + (new Date().toDateString()),
xtype: 'label'
}, '-',
{
text: 'WWWW: $6.94',
xtype: 'label'
}, '-',
{
text: 'Twitter: leads.com',
xtype: 'label'
}, '-',
{
iconCls: 'bsearch', // <-- icon
menu: { // <-- submenu by nested config object
items:
[
{
text: 'Option 1',
checked: true,
group: 'option1',
checkHandler: onItemCheck
}, {
text: 'Option2',
checked: false,
group: 'option2',
checkHandler: onItemCheck
}, {
text: 'Option3',
checked: false,
group: 'option3',
checkHandler: onItemCheck
}
]
} // assign menu by instance
},
{
xtype: 'textfield',
itemId: 'searchvalue',
hideLabel: true,
emptyText: 'Enter Keyword Here'
},
new Ext.Toolbar.SplitButton({
text: 'Search',
handler: onButtonClick,
menu: {
items: [
{
xtype: 'panel',
labelWidth: 75,
frame: true,
bodyStyle: 'padding:5px 5px 0',
width: 350,
height: 300,
defaults: { width: 230 },
defaultType: 'textfield',
forceLayout: true,
header: false,
layout: 'form',
items: [
combo1,
combo2,
combo3,
new Ext.Slider({
width: 214,
minValue: 0,
maxValue: 100,
fieldLabel: 'Slider'
}),
/*
* These two DateFields close the whole menu when you click on the icon to select a date
*/
new Ext.form.DateField({
autoShow: true,
hideParent: false,
fieldLabel: 'Start',
name: 'startDt',
allowBlank: false,
validateOnBlur: false
}), new Ext.form.DateField({
autoShow: true,
hideParent: false,
fieldLabel: 'End',
name: 'endDt',
allowBlank: false,
validateOnBlur: false
})
],
buttons: [
{
text: 'Search'
}, {
text: 'Clear'
}
]
}]
} // menu
}),
'-');

tb.doLayout();

opcode
17 Aug 2009, 10:31 PM
Got solved? I have a solution, though awkward:

listeners: {
beforehide: function(comp) {
return false;
}
}

Then you must handle the show/hide of the menu by yourself.

Lukman
18 Aug 2009, 4:27 AM
Add this into your DateField config options:


menu: new Ext.menu.DateMenu({
hideOnClick: false,
allowOtherMenus: true
}),

ntulip
18 Aug 2009, 5:31 AM
Add this into your DateField config options:


menu: new Ext.menu.DateMenu({
hideOnClick: false,
allowOtherMenus: true
}),


you are the man! thank you. allowOtherMenus: true was the key in my case.