This is the code which worked well with 3.0 and stopped working with 3.1:
Code:
var menu = new Ext.menu.DateMenu({
id: 'p' + element.dom.id,
format: format[index],
value: Date.parseDate(element.dom.value, format[index]),
handler: function(picker, date){
var relElement = Ext.getDom(picker.id.substring(1));
relElement.value = date.format(format[index]);
if (Ext.isFunction(relElement.onchange)) {
relElement.onchange.call(relElement);
}
},
listeners: {
beforeshow: function(picker) {
var relElement = Ext.getDom(picker.id.substring(1));
if (relElement.value) {
Ext.getCmp('p' + relElement.id).setValue(Date.parseDate(relElement.value, format[index]));
}
}
}
});
Here is the new code that works now:
Code:
var menu = new Ext.menu.DateMenu({
id: 'p' + element.dom.id,
format: format[index],
value: Date.parseDate(element.dom.value, format[index]),
handler: function(picker, date){
var relElement = Ext.getDom(picker.ownerCt.id.substring(1));
relElement.value = date.format(format[index]);
if (Ext.isFunction(relElement.onchange)) {
relElement.onchange.call(relElement);
}
},
listeners: {
beforeshow: function(picker) {
var relElement = Ext.getDom(picker.picker.ownerCt.id.substring(1));
if (relElement.value) {
picker.picker.setValue(Date.parseDate(relElement.value, format[index]));
}
}
}
});
The change is the picker object in handler and beforeshow listener.