DateField onChange event only on lost focus?
I added Ext.form.DateField component into toolbar. When I click on DateField Trigger button and select DateValue from DatePicker, selected value is added into input field. This is OK. But
change event is called only after clicking outside Datefield. It is there event or other way how update my grid automatically when date value from DatePicker is added to DateField component? Thanks
PHP Code:
var dateFrom = new Ext.form.DateField({
id: 'dateFrom',
width: 80,
value: todayDate,
selectOnFocus: false,
readOnly: true,
allowBlank: false
});
dateFrom.on('change', getFilteredValues);
function renderDate(value){
return value.dateFormat('d.m.Y');
}
function getFilteredValues() {
ds.on('beforeload', function() {
ds.baseParams = {
filterDateFrom: renderDate(dateFrom.getValue())
};
});
ds.load({params:{start:0, limit:myPageSize}});
}
Use 'select', not 'change'
I know this is an old thread, but I hit this problem today and realised what I was doing wrong, and so figured I'd report it here in case it helps others in the future.
So, I hit the problem that a DateField embedded in a toolbar was only firing the 'change' event when focus moved away from the DateField.
The solution was to use the 'select' event instead. It fires as soon as a date is selected. So, I now have:
Code:
new Ext.form.DateField({
readOnly: true,
listeners: {
'select' : {
fn: function(field, date) {
// ... do something useful here ...
}
}
}
});
cheers,
mick