2
격자 안에 표시되는 정적 (하드 코딩 된) 값이 거의없는 콤보 상자가 있습니다.콤보 상자의 기본값을 설정하는 방법
기본적으로 콤보 상자의 첫 번째 값이 표시되어야합니다. 나는 몇 가지 시도했지만 작동하지 않습니다. 내가 먼저 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");
}
}
}
]);