ext 清空onTrigger1Click

  1. Ext.app.SearchField = Ext.extend(Ext.form.TwinTriggerField, {  
  2.     initComponent : function(){  
  3.         Ext.app.SearchField.superclass.initComponent.call(this);  
  4.         this.on('specialkey'function(f, e){  
  5.             if(e.getKey() == e.ENTER){//按回车键时  
  6.                 this.onTrigger2Click();  
  7.             }  
  8.         }, this);  
  9.     },  
  10.   
  11.     validationEvent:false,  
  12.     validateOnBlur:false,  
  13.     trigger1Class:'x-form-clear-trigger',  
  14.     trigger2Class:'x-form-search-trigger',  
  15.     hideTrigger1:true,  
  16.     width:180,  
  17.     hasSearch : false,  
  18.     paramName : 'query',//查询的参数名  
  19.   
  20.     onTrigger1Click : function(){//清空查询条件  
  21.         if(this.hasSearch){  
  22.             this.el.dom.value = '';  
  23.             var o = {start: 0};  
  24.             this.store.baseParams = this.store.baseParams || {};  
  25.             this.store.baseParams[this.paramName] = '';  
  26.             this.store.reload({params:o});  
  27.             this.triggers[0].hide();  
  28.             this.hasSearch = false;  
  29.         }  
  30.     },  
  31.   
  32.     onTrigger2Click : function(){//点击查询按钮或回车调用该方法  
  33.         var v = this.getRawValue();  
  34.         if(v.length < 1){  
  35.             this.onTrigger1Click();  
  36.             return;  
  37.         }  
  38.         var o = {start: 0};  
  39.         this.store.baseParams = this.store.baseParams || {};  
  40.         this.store.baseParams[this.paramName] = v;  
  41.         this.store.reload({params:o});  
  42.         this.hasSearch = true;  
  43.         this.triggers[0].show();  
  44.     }  
  45. }); 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值