Thank you for reporting this bug. We will make it our priority to review this report.
-
Sencha Premium User
ComboBox selection with local filtering
Ext version tested:
Browser versions tested against:
Description:
- When filtering a combobox, you can reach a state where you are unable to click on any of the list items. At that point, if you attempt to select via keyboard entry, it will select based on the index of the unfiltered store and pick the incorrect record.
- I have a potential workaround that seems to help, but I'm not sure if it'll cause other issues along the way.
- I noticed this in the kitchen sink example in 6.0.0 also, but I think it may have been cleared up in 6.0.1
Steps to reproduce the problem:
- This can be reproduced using the kitchen sink example: http://dev.sencha.com/extjs/5.1.0/ex...e-loaded-combo
- Type "N" in the combobox.
- Select "New Hampshire" by clicking the appropriate row.
- Highlight the text from the combobox and Type "N" again.
- When you get to the point where the list isn't displayed upon typing "N", delete "N" and try again.
- This time, try clicking an item in the combobox and it likely will do nothing. It might take a couple attempts of filtering on the same letter and then deleting the text and trying again.
- Also, once it gets stuck, if you navigate to the record with the keyboard and select something you'll get a completely different record! (i.e. selecting nevada will result in the selection of alaska)
Potential Fix:
Code:
Ext.define('Ext.overrides.form.field.ComboBox', {
override:'Ext.form.field.ComboBox',
onFieldMutation: function(e) {
var me = this,
key = e.getKey(),
isDelete = key === e.BACKSPACE || key === e.DELETE,
rawValue = me.inputEl.dom.value,
len = rawValue.length;
// Do not process two events for the same mutation.
// For example an input event followed by the keyup that caused it.
// We must process delete keyups.
// Also, do not process TAB event which fires on arrival.
if (!me.readOnly && (rawValue !== me.lastMutatedValue || isDelete) && key !== e.TAB) {
me.lastMutatedValue = rawValue;
me.lastKey = key;
if (len && (e.type !== 'keyup' || (!e.isSpecialKey() || isDelete))) {
me.doQueryTask.delay(me.queryDelay);
} else {
// We have *erased* back to empty if key is a delete, or it is a non-key event (cut/copy)
if (!len && (!key || isDelete)) {
// Essentially a silent setValue.
// Clear our value, and the tplData used to construct a mathing raw value.
if (!me.multiSelect) {
me.value = null;
me.displayTplData = undefined;
}
// If the value is blank we can't have a value
if (me.clearValueOnEmpty) {
me.valueCollection.removeAll();
}
// Just erased back to empty. Hide the dropdown.
me.collapse();
// There may have been a local filter if we were querying locally.
// Clear the query filter and suppress the consequences (we do not want a list refresh).
if (me.queryFilter) {
// Must set changingFilters flag for this.checkValueOnChange.
// the suppressEvents flag does not affect the filterchange event
me.changingFilters = true;
me.store.removeFilter(me.queryFilter, true);
// OVERRIDE!
me.getPicker().refresh();
delete me.lastQuery;
// END OVERRIDE!
me.changingFilters = false;
}
}
me.callParent([e]);
}
}
}
});
-
Sencha - Support Team
Hi jkelley,
Can you put your example into a fiddle(https://fiddle.sencha.com) so we can review and diagnose with a Nightly build?
Regards,
Bryan