LocationCombo = Ext.extend(Ext.form.ComboBox,{
initComponent: function(){
var config = {
name: 'loactionCombo'
,hiddenName: 'loactionCombo'
,fieldLabel: '所在区域'
,store: [['-1','请选择...']]
,triggerAction: 'all'
,mode: 'local'
,autoScroll: true
,expandPanel : new LocationTree()
,listeners: {
'expand': function(){
alert('expand...');
// if(!combo.expanded){
// combo.expandPanel.render(combo.el);
// combo.doLayout();
// combo.expanded = true;
// //applyToMarkup
// }
}
,'collapse': function(){
alert('collapse');
//document.getElementById('tree').innerHTML='';
}
}
}
this.addListener('expand',function(){alert('2expand..')});
Ext.apply(this, config);
LocationCombo.superclass.initComponent.call(this);
}
initComponent: function(){
var config = {
name: 'loactionCombo'
,hiddenName: 'loactionCombo'
,fieldLabel: '所在区域'
,store: [['-1','请选择...']]
,triggerAction: 'all'
,mode: 'local'
,autoScroll: true
,expandPanel : new LocationTree()
,listeners: {
'expand': function(){
alert('expand...');
// if(!combo.expanded){
// combo.expandPanel.render(combo.el);
// combo.doLayout();
// combo.expanded = true;
// //applyToMarkup
// }
}
,'collapse': function(){
alert('collapse');
//document.getElementById('tree').innerHTML='';
}
}
}
this.addListener('expand',function(){alert('2expand..')});
Ext.apply(this, config);
LocationCombo.superclass.initComponent.call(this);
}
});
使用initComponent时,在config对象中写listeners无效,需使用方法添加。而使用constructor则支持 在config对象中写listeners,但ext.2.0不支持constructor.