【问题标题】:ExtJs ComboBox auto expandExtJs ComboBox 自动展开
【发布时间】:2012-01-07 09:21:02
【问题描述】:

我正在尝试在事件发生后扩展组合框的内容。

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();
}
});

但是在expand() 和将'*' reqex 用于搜索条件之后,没有扩展列表。我尝试使用设置为 0 的 'minChars' 参数,但也没有结果。

【问题讨论】:

    标签: extjs combobox


    【解决方案1】:

    如果要自动展开组合框列表,可以使用“onTriggerClick()”:

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

    此示例在渲染后自动扩展组合框的内容...

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        【解决方案3】:

        在 load() 之后调用 expand()。

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

        【讨论】:

          【解决方案4】:

          以下代码适用于 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
                  }
                  });
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2013-08-25
            • 2013-06-09
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2011-10-20
            • 1970-01-01
            • 2011-03-18
            相关资源
            最近更新 更多