ExtのComboboxでonTriggerイベントをカスタマイズ

Ext.form.ComboBoxはドキュメントには載っていないですが、コンフィグにonTriggerを用意することで、onTriggerイベントをオーバーライドすることが出来ます。

ExtのComboboxデモのソースをそのまま使用するとonTriggerごとにphpへアクセスする動作が出来なかったのでオーバーライドで修正しました。

conveyorのtrunkでlineリストをロードするのに使用しました。
実際に使用しているソースとは違いますが、以下のようにできます。

privateなプロパティを修正したり、privateなメソッドを使ってるのであまり良くないとは思うんですけどねー。

  var store = new Ext.data.Store({
            Ext.data.HttpProxy({method:'GET',url:'アドレス'}),
            reader: new Ext.data.JsonReader({
                root: 'root'
            }, Ext.data.Record.create([{name: 'hoge'},{name:'fuga'}]))
        });
  });
  var combo = new Ext.form.ComboBox({
                mode:'remote',
                store: store,
                valueField: 'hoge',
                displayField:'fuga',
                loadingText:'Loading...',
                onTriggerClick:function(){
                	this.store.reload();
                	this.bindStore(this.store,true);
			        if(this.disabled){
			            return;
			        }
			        if(this.isExpanded()){
			            this.collapse();
			            this.el.focus();
			        }else {
			            this.onFocus({});
			            if(this.triggerAction == 'all') {
			                this.doQuery(this.allQuery, true);
			            } else {
			                this.doQuery(this.getRawValue());
			            }
			            this.el.focus();
			        }
                 },
                scope:this
            });


オーバーライドする時は元のソースを入れておかないと当然動きがおかしくなります。
念のため。