View Full Version : Combobox items disappears after adding to the store

6 Aug 2013, 8:02 AM
Perhaps a noob question...I have the following code:

L = Ext.getCmp('combobox1');
L.store.addListener('datachanged', function(){console.log('datachanged')});
for (i in data) {
L.store.add({text: data[i].text})
The combobox is rendered already and is empty. The code is meant to populate them with items(stored previously in data). After I click the combobox, the items are gone(the datachanged event is fired, verified by the addListener method applied before). Before the click, the store contains all the items(verified this by logging the L.store.data.items object ).
Thanks in advance!

11 Aug 2013, 4:10 PM
First thing that jumps out at me is instead of executing store.add for however many items are in data, why not build an array and execute store.add once?

13 Aug 2013, 6:50 AM
Sounds fine for an optimization in the algorithm, but what would be the difference in expected functionality?