Friday, 24 February 2017

How to add dynamically store data to combobox

Am going to bind the data to combobox store dynamically. below is the combobox how to define the properties and all.

xtype: 'combobox',
width: '10%',
reference: 'Amount',
fieldLabel: 'Amount',
labelSeparator: "",
labelAlign: 'top',
queryMode: 'local',
store: new Ext.data.JsonStore({
fields: ['id', 'display', 'value']
}),
displayField: 'display',
valueField: 'value',
emptyText: 'Select',
name: 'relationType',
submitEmptyText: false,
allowBlank: false,
style: '141px',
listeners: {
change: 'onSelectionChange'
}



In controllerthe code will be.


var multiplyCombo = fieldsContainer.down('combobox').getStore();
var bulkAddArray = [];
for (var i = 1; i <= multiplyFactor; i++) {
bulkAddArray.push({
display: i,
value: i
});
}
multiplyCombo.loadData(bulkAddArray, true);


No comments:

Post a Comment