本文主要是介绍ext 清空onTrigger1Click,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- Ext.app.SearchField = Ext.extend(Ext.form.TwinTriggerField, {
- initComponent : function(){
- Ext.app.SearchField.superclass.initComponent.call(this);
- this.on('specialkey', function(f, e){
- if(e.getKey() == e.ENTER){//按回车键时
- this.onTrigger2Click();
- }
- }, this);
- },
- validationEvent:false,
- validateOnBlur:false,
- trigger1Class:'x-form-clear-trigger',
- trigger2Class:'x-form-search-trigger',
- hideTrigger1:true,
- width:180,
- hasSearch : false,
- paramName : 'query',//查询的参数名
- onTrigger1Click : function(){//清空查询条件
- if(this.hasSearch){
- this.el.dom.value = '';
- var o = {start: 0};
- this.store.baseParams = this.store.baseParams || {};
- this.store.baseParams[this.paramName] = '';
- this.store.reload({params:o});
- this.triggers[0].hide();
- this.hasSearch = false;
- }
- },
- onTrigger2Click : function(){//点击查询按钮或回车调用该方法
- var v = this.getRawValue();
- if(v.length < 1){
- this.onTrigger1Click();
- return;
- }
- var o = {start: 0};
- this.store.baseParams = this.store.baseParams || {};
- this.store.baseParams[this.paramName] = v;
- this.store.reload({params:o});
- this.hasSearch = true;
- this.triggers[0].show();
- }
- });
这篇关于ext 清空onTrigger1Click的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!