-
cannot populate Combo with dynamic array
cannot populate Combo with dynamic array
Hi, I am trying to populate an Ext.form.ComboBox using a dynamically created 2 - d array.
Whereas a static 2 - d array like the one below works
Code:
var messageTypecombo = new Ext.form.ComboBox({
allowBlank: false,
typeAhead: true,
triggerAction: 'all',
store: new Ext.data.SimpleStore({
fields: ['value', 'name'],
data: [
[0, 'Station Promo'],
[1, 'Program Promo'],
[2, 'Sponsor']
]
}),
mode: 'local',
displayField: 'name',
valueField: 'value'
});
The dynamic array like the one below does not. It displays only a 0 in the combo box
Code:
var messageTypesArr = [];
messageTypesArr.push([0, 'Station Promo']);
messageTypesArr.push([1, 'Program Promo']);
messageTypesArr.push([2, 'Sponsor']);
Code:
var messageTypecombo = new Ext.form.ComboBox({
allowBlank: false,
typeAhead: true,
triggerAction: 'all',
store: new Ext.data.SimpleStore({
fields: ['value', 'name'],
data: messageTypesArr
}),
mode: 'local',
displayField: 'name',
valueField: 'value'
});
Please help
-
Found the error.
I was trying to pouplate the combo before the dynamic array had been loaded.
Silly me.
Dear Admin, please delete this thread
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us