Hello,
I use the xdatetime extension in combination with Extjs 3.4.0. (but I had the same problem already in some older 3.0 versions).
At first sight, everything is working fine. As long as I manually change the date and timefields, the values show up correctly, and can be correctly retrieved with formValues().
But I want to preset values in those fields by using setValue(). Also this seems to work at first sight: if I do setValue(date) or setValue(time), date and time are indeed showing up correctly in the date and timefields.
However, when the form is processed (=when I use formValues() ), the retrieved date and time fields of the xdatetimefields still contain the old values (the ones before setValue() was used). So I can never submit the correct preset values to the server, only values that have been changed manually.
I also noticed that if I just focus/blur those fields once manually before I call formValues(), then I do get the right values. So I thought about a workaround by simulating this with fireEvent(focus) or fireEvent(blur), but this does not have the desired effect.
Anybody has an idea what is going on?
Best regards, Marcvdm.
Below is a sample of code. The buttons are meant for quickly jumping a day or a week backwards, similar buttons exist on the page to jump a day or a week forward. Which is what they appear to do on screen, but as explained above, they keep submitting the original values.
And yes, I checked already that hey all have unique component id's
Code:
{
xtype: 'panel',
layout: 'column',
hidden: false,
items: [{
xtype: 'button',
text: '<< ',
tooltip: 'a week sooner',
listeners: {
click: function ClickWeekSooner(){
var begintime=Ext.getCmp('begintime');
begintime.df.setValue(begintime.df.getValue().add(Date.DAY,-7));
var endtime=Ext.getCmp('endtime');
endtime.df.setValue(endtime.df.getValue().add(Date.DAY,-7));
}
}
},{
xtype: 'button',
text: '<  ',
tooltip: 'a day sooner',
listeners: {
click: function ClickdaySooner(){
var begintime=Ext.getCmp('begintime');
begintime.df.setValue(begintime.df.getValue().add(Date.DAY,-1));
var endtime=Ext.getCmp('endtime');
endtime.df.setValue(endtime.df.getValue().add(Date.DAY,-1));
}
}
}]
}