2010-08-27 70 views
4

我想篩選商店從組合中選擇值。當我選擇第一個值不過濾,但在選擇任何其它的值第2次效果很好 我的店裏有自動加載=真正 這裏是我的代碼EXTJS:過濾器存儲沒有發生首先點擊組合

xtype: 'combo' 
,fieldLabel: 'Online Type' 
,name:'OnlineType' 
,id:'cmbOnlineType' 
,store: common.getStore(accounts20.dataForms.onlinePayments._storeOnlineType, accounts20.dataForms.onlinePayments) 
,displayField:'OnlineType' 
,valueField:'OnlineType' 
,mode:'local' // important property when using store 
,typeAhead: true 
,triggerAction: 'all' 
,selectOnFocus:true 
,allowBlank:false 
,forceSelection:true 
,editable:true 
,tabIndex:4 
,width : 188 
,listeners:{ 
    select:function(){ 
     if(Ext.getCmp('onlinePay-hdnMode').value!="E") 
     { 
      Ext.getCmp('onlinePay-cmbChequeNo').clearValue(); 
      Ext.getCmp('onlinePay-cmbChequeNo').getStore().removeAll(); 
      Ext.getCmp('onlinePay-cmbCrAccount').clearValue(); 
     } 
     var store = Ext.getCmp('onlinePay-cmbCrAccount').getStore(); 
     if(this.getValue()=="Cheque" || this.getValue()=="Internet/Mobile") 
     { 
      Ext.getCmp('onlinePay-chkIncCharges').setValue(false); 
      if(this.getValue()=="Internet/Mobile") 
      { 
       Ext.getCmp('onlinePay-cmbChequeNo').disable(); 
       Ext.getCmp('onlinePay-chkIncCharges').disable(); 
      }else{ 
       Ext.getCmp('onlinePay-cmbChequeNo').enable(); 
       Ext.getCmp('onlinePay-chkIncCharges').enable(); 
      } 
      //Filter store on bank accounts 
      store.filter([ 
       { 
        property  : 'AccountTypeId', 
        value  : 'B',//Bank Accounts 
        anyMatch  : true, //optional, defaults to true 
        caseSensitive: false //optional, defaults to true 
       } , 
       //filter functions can also be passed 
       { 
        fn : function(record) { 
         return record.get('AccountTypeId') == 'B'; 
        }, 
        scope: this 
       } 
      ]); 
     }else if(this.getValue()=="Cash"){ 
      Ext.getCmp('onlinePay-chkIncCharges').setValue(true); 
      Ext.getCmp('onlinePay-chkIncCharges').disable(); 
      Ext.getCmp('onlinePay-cmbChequeNo').disable(); 
      //Filter store on cash accounts 
      store.filter([ 
       { 
        property  : 'AccountTypeId', 
        value  : 'C',//Cash Accounts 
        anyMatch  : true, //optional, defaults to true 
        caseSensitive: false //optional, defaults to true 
       } , 
       //filter functions can also be passed 
       { 
        fn : function(record) { 
         return record.get('AccountTypeId') == 'C'; 
        }, 
        scope: this 
       } 
      ]); 
     } 
    }//end of select function 
}//end of listener 

回答

0

如果select事件被觸發兩次使用緩衝區配置,它將緩衝事件以僅觸發一個事件。另外,上面的鏈接是http://www.sencha.com/forum/showthread.php?134147的副本,在4.0.2中修復(至少這是我們的錯誤跟蹤器所說的)。