View Full Version : Combobox Add Items before/after render

I'm Dennis
12 Jan 2012, 5:07 AM
I'm making a ComboBox with ArrayStore as a part of a toolbar like this:

emptyText: 'All Levels',
xtype: 'combobox',
editable: false,
width: 100,
forceSelection: true,
store: new Ext.data.ArrayStore({
fields: ['name'],
data: [['All Levels']]
listeners: {
beforerender: function(me) {
var levels = [['Level 1'], ['Level 2']];
me.getStore().loadRawData(levels, true);

As a result I see no "Level 1" and "Level 2" Options. The only option is "All Levels", although in store I can see 3 items in "data" property

1 .Any suggestion why is that happens? Should I somehow refresh ComboBox after I've changed storage to start displaying extra 2 options?
2. Isn't there any easier (a ComboBox-level?) way to add an Option to a ComboBox like this: myCombobox.addOption(["Level 1"]);

12 Jan 2012, 11:08 AM
BoundList does not listen for the datachanged event, only load so you would have to hook up a datachanged event to have BoundList refresh.