PDA

View Full Version : [solved] TimeField in EditorGridPanel returns empty value



PiExt
18 Jun 2009, 6:20 AM
I am using Ext 3.0 RC2. In my EditorGridPanel I have a TimeField as editor.

If I select a value and click outside the TimeField it returns a empty value into the grid.

It works fine if I select a value and press enter. I added some logging but I am not sure how to handle this problem.

I think the problem appeared with the update to Ext 3 from Ext 2.2 but I am not sure.
The following code is a reduced version. I hope I didn't cut out something important.



var Eintrag = Ext.data.Record.create([
{name: 'localFrom'}
]);
var store = new Ext.data.Store({
url: '/gethours',
reader: new Ext.data.JsonReader({
root: 'rows',
id: 'id'
},Eintrag)
});
function rndTime(val){
return val;
}
var gridPanel = new Ext.grid.EditorGridPanel({
id: 'gridPanel',
renderTo: Ext.get('gridDiv'),
store: store,
border: false,
autoHeight: true,
stripeRows: true,
clicksToEdit: 1,
viewConfig:{
forceFit: true
},
columns: [
{
id: 'localFrom',
header: '<?= $this->translate('Von') ?>',
dataIndex: 'localFrom',
sortable: true,
renderer: rndTime,
editor: new Ext.form.TimeField({
format:'H:i:s',
allowBlank:false,
listeners: {select: function(){
console.log(this.getValue()); // value as expected
}, blur: function(){
console.log(this.getValue()); // empty
}},
increment:15})
}
]
});
Thanks for your time!
Greetings Philipp

PiExt
18 Jun 2009, 6:34 AM
Dirty workaround...



var timeHack;
// ...
editor: new Ext.form.TimeField({
format:'H:i:s',
allowBlank:false,
listeners: {select: function(){
timeHack = this.getValue();
}, blur: function(){
this.setValue(timeHack);
}, show: function(){
timeHack = this.getValue();
}},
// ...

deemonas
25 Jun 2009, 4:04 AM
I have the same problem after I upgraded my code from Ext 2.2.1 to Ext 3.0 rc2

If you select time and click with mouse outside timefield menu - the menu get blank, so you loose your time value. Using the dirty hack at the moment which is not very good programming style :((

grzegorz.borkowski
26 Jun 2009, 3:02 PM
I have the same problem, have you reported it on Ext 3.0 bugs (sub)forum? It's definitely the bug in 3.0.RC2, it worked in 2.2.1.
In my case I use GridPanel with RowEditor, but the effect is the same.

grzegorz.borkowski
26 Jun 2009, 3:05 PM
Ok I found, it's already reported: http://extjs.com/forum/showthread.php?t=70210

PiExt
30 Jun 2009, 3:06 AM
Thanks, this solves the problem for me:
http://extjs.com/forum/showthread.php?p=339926#post339926