我有一个组合框,其中显示在网格内的静态(硬编码)值很少。
默认情况下,它应该在组合框中显示第一个值。我尝试了几件事,但它不起作用。我先创建 StaticComboBox 然后
var StaticComboBox = Ext.extend(Ext.form.ComboBox, {
mode: 'local',
triggerAction: 'all',
editable: false,
valueField: 'value',
displayField: 'label',
data: [],
initComponent: function() {
this.store = new Ext.data.ArrayStore({
fields: ['value', 'label'],
data: this.data
});
StaticComboBox.superclass.initComponent.call(this);
}
});
var cm = new Ext.grid.ColumnModel([
{
id:'language',
header: "Language",
dataIndex: 'language',
width: 235,
menuDisabled: true,
editor: new StaticComboBox({
name: 'Reasons',
data: [
[0, 'Reason 1'],
[1, 'Second Reason'],
[2, 'Something else']
]
}),
listeners: {
load: function () {
//set the ComboBox value here
var combo = Ext.getCmp('language');
combo.setValue("1");
}
}
}
]);