View Full Version : Combo box with local store

7 Mar 2013, 4:56 PM
I have some forms that get loaded from a database. The end user clicks on table records and these forms get loaded. Standard stuff. I have one client that is occasionally getting either an empty combo box or a combo box with partial data. The strange part is that these are local store combo box's so there is no database loading. I expect to have the information in those boxes available all the time since they don't need to go back to the database and there shouldn't be time delays or time outs. One of the combo boxes has even loaded one piece of the data array which is odd, so out of a list of 7 days of the week only Thursday is showing for some reason. In all cases they can log out and back in and it is corrected. Just wondering if anyone has seen this behavior before. Thank you!

8 Mar 2013, 4:40 AM
My guess is that the store is getting filtered. It could be a misconfiguration on the combobox or a shared store problem.

8 Mar 2013, 7:39 AM
I believe you are right. Further investigation show that once those combo boxes are empty or only show parshal records, even changing to other records doesn't reset them. Only a log out and back in (that reloads the code) fixes it. My thought is to reload the combo box's with loadData on every record change, any thoughts on a more efficient solution? You mention filter, I will look at the API, thank you for you feedback.

8 Mar 2013, 8:07 AM
You need to isolate the bug before hacking in any kind of workaround.

ComboBoxes with local data use filtering internally to restrict the list but that only makes sense in certain cases. It may well be that you have conflicting config options. As you haven't posted any code it's difficult to say.

8 Mar 2013, 8:20 AM
The form this combo box lives in is getting the following applied every record change to re-setup the form:
contractplaceholderPanel5.getForm().setValues(obj); Here is the code for the combo box and local store:
var stateData = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data: [
{ "abbr": "AL", "name": "Alabama" },
{ "abbr": "AK", "name": "Alaska" },
{ "abbr": "AZ", "name": "Arizona" },
{ "abbr": "AR", "name": "Arkansas" },
{ "abbr": "CA", "name": "California" },
{ "abbr": "CO", "name": "Colorado" },
{ "abbr": "CT", "name": "Connecticut" },
{ "abbr": "DE", "name": "Delaware" },
{ "abbr": "DC", "name": "District of Columbia" },
{ "abbr": "FL", "name": "Florida" },
{ "abbr": "GA", "name": "Georgia" },
{ "abbr": "HI", "name": "Hawaii" },
{ "abbr": "ID", "name": "Idaho" },
{ "abbr": "IL", "name": "Illinois" },
{ "abbr": "IN", "name": "Indiana" },
{ "abbr": "IA", "name": "Iowa" },
{ "abbr": "KS", "name": "Kansas" },
{ "abbr": "KY", "name": "Kentucky" },
{ "abbr": "LA", "name": "Louisiana" },
{ "abbr": "ME", "name": "Maine" },
{ "abbr": "MD", "name": "Maryland" },
{ "abbr": "MA", "name": "Massachusetts" },
{ "abbr": "MI", "name": "Michigan" },
{ "abbr": "MN", "name": "Minnesota" },
{ "abbr": "MS", "name": "Mississippi" },
{ "abbr": "MO", "name": "Missouri" },
{ "abbr": "MT", "name": "Montana" },
{ "abbr": "NE", "name": "Nebraska" },
{ "abbr": "NV", "name": "Nevada" },
{ "abbr": "NH", "name": "New Hampshire" },
{ "abbr": "NJ", "name": "New Jersey" },
{ "abbr": "NM", "name": "New Mexico" },
{ "abbr": "NY", "name": "New York" },
{ "abbr": "NC", "name": "North Carolina" },
{ "abbr": "ND", "name": "North Dakota" },
{ "abbr": "OH", "name": "Ohio" },
{ "abbr": "OK", "name": "Oklahoma" },
{ "abbr": "OR", "name": "Oregon" },
{ "abbr": "PA", "name": "Pennsylvania" },
{ "abbr": "PR", "name": "Puerto Rico" },
{ "abbr": "RI", "name": "Rhode Island" },
{ "abbr": "SC", "name": "South Carolina" },
{ "abbr": "SD", "name": "South Dakota" },
{ "abbr": "TN", "name": "Tennessee" },
{ "abbr": "TX", "name": "Texas" },
{ "abbr": "UT", "name": "Utah" },
{ "abbr": "VT", "name": "Vermont" },
{ "abbr": "VA", "name": "Virginia" },
{ "abbr": "WA", "name": "Washington" },
{ "abbr": "WV", "name": "West Virginia" },
{ "abbr": "WI", "name": "Wisconsin" },
{ "abbr": "WY", "name": "Wyoming" }

Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: 'States Operating In',
displayField: 'name',
valueField: 'abbr',
id: 'statesbox',
name: 'statesBox',
labelAlign: 'top',
emptyText: 'Select a State or States Operating In...',
store: stateData,
queryMode: 'local',
anchor: '50%',
columnWidth: .50,
listeners: {
'change': function (field, newValue, oldValue) {
if (newValue == "") {
} else {
field.encodeSubmitValue = true;
taxcodelistStore.getProxy().extraParams.states = newValue;
if (taxentriesGrid.getSelectionModel().hasSelection()) {
var rec = taxentriesGrid.getSelectionModel().getSelection()[0];
taxcodelistStore.load({ callback: function () { Ext.getCmp('agencystructure').setValue(rec.data.agency + rec.data.structure); } });
} else {
'select': function (field, records) {
//console.log('[Select event] ' + records.length + ' records selected.');

8 Mar 2013, 8:43 AM
Ah, BoxSelect, not ComboBox.

Try it with a normal ComboBox. If you can come up with a test case for that then we can continue digging. If the problem is solely exhibited using a BoxSelect then you'll have to consult the author of that UX.

8 Mar 2013, 8:43 AM
Thank you for you time looking at this and your helpful comments. You initial "filter" comment kept me looking and I found my issue. The client is able to go in and "edit" previous entries in a table in this form. When they select from this table I am setting the state for that entry, but never setting the data back so the data is not there for the next record. Now that I can recreate the issue I will be able to fix it. Thanks again for you contribution.