-
23 Jan 2013 3:26 AM #1
[4.0.7] ComboBox: setted to empty string when typing while a remote query is running
[4.0.7] ComboBox: setted to empty string when typing while a remote query is running
REQUIRED INFORMATION
Ext version tested:- Ext 4.0.7
- Mozilla Firefox 18.0.1
- Chrome 24
- Ext.form.field.ComboBox: When typing something into the textfield while a remote query is currently running, the value of the combobox will be setted to an empty value if the query result is empty.
- The problem begins in ComboBox.onLoad (comments edited): Code:
onLoad: function() { var me = this, value = me.value; if (me.rawQuery) { me.rawQuery = false; me.syncSelection(); if (me.picker && !me.picker.getSelectionModel().hasSelection()) { me.doAutoSelect(); } } // rawQuery is false is the second query (resetted by the first query), so were are here else { if (me.value) { me.setValue(me.value); // we don't have selected a value } else { if (me.store.getCount()) { me.doAutoSelect(); } else { // store is empty, so this is called me.setValue(''); } } } } - Next problem is in setValue: store.loading is false in the second query because it is setted to false after the first query has been finished. This is problematic because the second query is sent after the first one is finished.Code:
if (me.store.loading) { me.value = value; me.setHiddenValue(me.value); return me; }
- Create a combobox with queryMode="remote".
- Type a value into the field of the box.
- While query is running, change the value to something for that no result will be found.
- The field should keep the entered value.
- The box will be setted to an empty value.
Code:Ext.create("Ext.form.field.ComboBox", { columnWidth: 1, displayField: "display", minChars: 2, queryDelay: 150, queryMode: "remote", //queryParam: "search", renderTo: document.body, store: Ext.create("Ext.data.Store", { proxy: { reader: "json", type: "ajax", url: "some url (should take a moment to load)" } }), triggerAction: "query", valueField: "value", width: 400 });
HELPFUL INFORMATION
Possible fix:- An approach could be to set store.loading to something like a counter. Increment it after sending a query and decrement it after a query has been finished. This way store.isLoading will return the correct value even for concurrent queries.
- Max OS X 10.6.8 (but should not matter)
Last edited by Chrischan; 25 Jan 2013 at 8:00 AM. Reason: simplified example code
-
23 Jan 2013 7:43 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
The first request should be canceled.
Have you tried this in a newer release? 4.0.7 is quite old now.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
25 Jan 2013 7:58 AM #3
I tested it with 4.1.1a, the bug still occurs.
-
4 Feb 2013 12:06 AM #4
Which information is missing?Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.


Reply With Quote