PDA

View Full Version : Timefield in EditorGrid: prior value in pulldown



pauljtaylor
1 Dec 2011, 12:43 PM
Hey, everyone.

I've got a gridPanel in 4.07 with the rowEditing plug-in. I've got a field for the end time of a task:


{
header: 'End Time',
dataIndex: 'endtime',
width: 80,
editor: {
xtype: 'timefield',
allowBlank: true
}
}

I can add a row and choose, say, 3:30 PM as the end time.

If I add another row after that, I'll expand the end time picker, and 3:30 PM is highlighted and not selectable. Likewise, if I choose a row to edit that already has data (the end time in that row may be 2:30 PM, for example), the picker still has 3:30 PM highlighted and unavailable, where the expected behavior is that 2:30 PM would be the unavailable choice. The only work around is to choose another time like midnight... that will lock 12:00 AM and make 3:30 PM available for choosing.

Is there something I'm setting up incorrectly? I've stripped down the configs of the timefield to the bare bones, but maybe that's the problem...?

mitchellsimoens
2 Dec 2011, 7:49 AM
I'm not seeing this in our latest code but it sounds like the value just isn't being cleared.

pauljtaylor
2 Dec 2011, 8:16 AM
I've tried setting defaultValue: new Date(), but the picker still highlights and locks the prior selection. I'm not sure how to clear out the picker value, or to tell the control I don't want any values disabled despite making logical sense to prevent a user from selecting the value that was already in the field.

adisharoon
5 Dec 2011, 7:41 AM
I'm having the same problem. The reset() method of the time field also doesn't help - the value resets, but the last selected option in the picker is still highlighted.

This presents a problem when multiple rows in the EditorGrid need the same time - first a different time has to be selected, then the original time reselected.

pauljtaylor
5 Dec 2011, 7:47 AM
Yes, this is exactly the problem I am having in my application, which is basically a timesheet. Many of the employees work from 9:00 AM to 5:00 PM, and once 9:00 AM is selected as the start time in the first row, something else has to be entered into the second before 9:00 AM is freed up.

I am having them just type military time into the field as a workaround for now.

pauljtaylor
5 Dec 2011, 11:54 AM
I've been trying to override Ext.form.field.Time's onExpand function. There seems to be some code that makes the prior value highlight. Having no luck, though.


Ext.override(Ext.form.field.Time,{
onExpand: function(){
var me = this,
keyNav = me.pickerKeyNav,
selectOnTab = me.selectOnTab,
picker = me.getPicker(),
lastSelected = picker.getSelectionModel().lastSelected,
itemNode;

if (!keyNav) {
keyNav = me.pickerKeyNav = Ext.create('Ext.view.BoundListKeyNav', this.inputEl, {
boundList: picker,
forceKeyDown: true,
tab: function(e) {
if (selectOnTab) {
if(me.picker.highlightedItem) {
this.selectHighlighted(e);
} else {
me.collapse();
}
me.triggerBlur();
}
return true;
}
});
if (selectOnTab) {
me.ignoreMonitorTab = true;
}
}

Ext.defer(keyNav.enable, 1, keyNav);

if (lastSelected) {
//picker.clearHighlight();
}
}
});

tomearly
28 Feb 2012, 11:59 PM
Hi,

I'm having exactly the same problem. Only seems to happen with a timefield.

I modified the Ext.grid.plugin.RowEditing to include a timefield (changed the email field to timefield) and can replicate the exact same problem.

Did anyone fix this?

Thanks,

Tom