PDA

View Full Version : ext3rc2 roweditor and local combo



TopKatz
10 Jun 2009, 7:58 AM
I have a roweditor on a grid that is using a combo with a simple store as an editor:

combo:


this.comment = {
xtype:'combo',
allowBlank:true,
store: new Ext.data.SimpleStore({
fields:['comment'],
data: [['Not Home'],['No Laundry']]
}),
displayField:'comment',
mode:'local',
triggerAction:'all'
};


cm:


{header:'Comment', dataIndex:'comment', width:70, editor:this.comment}


The editor and combo appear to work, however if you make a selection in the combo, and press tab, the value in the combo gets wiped out. If I press enter while focus is in the combo it takes the value and updates the store with it. However the user might not always press enter, and may in fact want to tab to another field.

This can be replicated in the examples by altering the /examples/grid/row-editor.js file. Drop my combo config into on of the editor configs (like line 122) and make a selection from the combo, then tab off the field.

Is this a known issue?

TopKatz
10 Jun 2009, 10:11 AM
Changing the grid over to a editorgrid, and commenting out the roweditor plugin causes the combo to work as expected. This appears to be a roweditor specific problem with handling the combo only.

TopKatz
11 Jun 2009, 5:26 AM
Aaron helped point me in the right direction on irc.

Use this override to fix the problem:


Ext.override(Ext.form.ComboBox, {
beforeBlur: function() {
var val = this.getRawValue();
if (this.forceSelection) {
if (val.length > 0 && val != this.emptyText) {
this.el.dom.value = this.lastSelectionText === undefined ? '': this.lastSelectionText;
this.applyEmptyText();
} else {
this.clearValue();
}
} else {
var rec = this.findRecord(this.displayField, val);
if (rec) {
val = rec.get(this.valueField || this.displayField);
}
this.setValue(val);
}
}
});

Link to post

http://extjs.com/forum/showthread.php?t=70210&highlight=timefield

mjlecomte
11 Jun 2009, 5:46 AM
FYI there's a stickied thread in this forum for upgrade notes. I see some things you're not availing yourself of, for example ArrayStore and autoDestroy.