PDA

View Full Version : [UNKNOWN][3.1] DateField menu hideOnClick bug



mono blaine
17 Dec 2009, 10:33 AM
The function onSelect of DateField is as follows:


onSelect: function (m, d) {
this.setValue(d);
this.fireEvent('select', this, d);
this.menu.hide();
}

Shouldn't that be something like


onSelect: function (m, d) {
this.setValue(d);
this.fireEvent('select', this, d);
if (this.menu.hideOnClick) {
this.menu.hide();
}
}

?

Because for the other way, DateField simply ignores the hideOnClick config, and it is important when we extend.

Well, this not the correct solution to this problem, because the hideOnClick config for the DateMenu of DateField is hardcoded:


onTriggerClick: function () {
...
this.menu = new Ext.menu.DateMenu({
hideOnClick: false,
focusOnSelect: false
});
...
}

Maybe it could be made configurable by being added to the config of DateField and it will therefore be something like:


Ext.form.DateField = Ext.extend(Ext.form.TriggerField, {
menuHideOnClick: false,
...
});

onTriggerClick: function () {
...
this.menu = new Ext.menu.DateMenu({
hideOnClick: this.menuHideOnClick,
focusOnSelect: false
});
...
}