2011-11-27 80 views
4

我试图展开事件后组合框的内容。ExtJs组合框自动展开

Ext.onReady(function(){ 

var mycb = new Ext.form.ComboBox({ 
    //params 
}); 

//here is other event 
var other = .... 
    onChange: function() { 
    //here I'm trying to expand 
    mycb.expand(); 
} 
}); 

但经过扩展()和搜索条件将“*” reqex没有扩大名单。我试图使用'minChars'参数设置为0,但也没有结果。

回答

1

尝试在展开组合商店之前加载组合商店。

2

如果你想自动展开ComboBox的列表,你可以使用“onTriggerClick()”:

Ext.onReady(function(){ 

    var mycb = new Ext.form.ComboBox({ 
    // params 
    listeners: { 
     afterrender: function (cb) { 
      cb.onTriggerClick(); 
     } 
    } 
    }); 

}); 

这个例子自动展开组合框渲染后的内容...

1

呼叫扩大()在load()之后。

listeners: { 
    change: function (obj, newValue, oldValue, eOpts) { 
     store.proxy.extraParams.keyword = newValue; 
     store.load(); 
     this.expand(); 
    } 
} // listeners 
1

下面的代码适用于extjs3.3。它可以帮助一些人

var taxonomyTreePanel = new Ext.form.ComboBox({ 
     id: 'taxTreePanel', 
     store:new Ext.data.SimpleStore({fields:[],data:[[]]}), 
     editable:false, 
     //z-index: 7000, 
     typeAhead:false,//done by siddhartha 
     selectOnFocus:true, 
     shadow:false, 
     mode: 'local', 
     triggerAction:'all', 
     maxHeight: 200, 
     width: 340, 
     emptyText:"Select Resource Category", 
     tpl: '<tpl for="."><div style="height:210px"><div id="taxonomyTreediv"></div></div></tpl>', 
     selectedClass:'', 
     forceSelection: true, 
     onSelect:Ext.emptyFn, 
     listeners: { 
      afterrender: function (obj) { 
       if(singleParamDynamicQuery &&docTypeCodeDynamciQuery.length>0){ 
        obj.onTriggerClick(); 
       } 
      } 
     }, 
     onViewClick : function(doFocus){ 
     //do nothing 
     } 
     });