Last change
on this file since 624 was
619,
checked in by ramonb, 15 years ago
|
lib/:
- added new AJAX dependancies: ExtJS, pChart, Lightbox2
|
File size:
1.4 KB
|
Line | |
---|
1 | /* |
---|
2 | * Ext JS Library 2.1 |
---|
3 | * Copyright(c) 2006-2008, Ext JS, LLC. |
---|
4 | * licensing@extjs.com |
---|
5 | * |
---|
6 | * http://extjs.com/license |
---|
7 | */ |
---|
8 | |
---|
9 | Ext.app.SearchField = Ext.extend(Ext.form.TwinTriggerField, { |
---|
10 | initComponent : function(){ |
---|
11 | Ext.app.SearchField.superclass.initComponent.call(this); |
---|
12 | this.on('specialkey', function(f, e){ |
---|
13 | if(e.getKey() == e.ENTER){ |
---|
14 | this.onTrigger2Click(); |
---|
15 | } |
---|
16 | }, this); |
---|
17 | }, |
---|
18 | |
---|
19 | validationEvent:false, |
---|
20 | validateOnBlur:false, |
---|
21 | trigger1Class:'x-form-clear-trigger', |
---|
22 | trigger2Class:'x-form-search-trigger', |
---|
23 | hideTrigger1:true, |
---|
24 | width:180, |
---|
25 | hasSearch : false, |
---|
26 | paramName : 'query', |
---|
27 | |
---|
28 | onTrigger1Click : function(){ |
---|
29 | if(this.hasSearch){ |
---|
30 | this.el.dom.value = ''; |
---|
31 | this.store.baseParams = this.store.baseParams || {}; |
---|
32 | this.store.baseParams[this.paramName] = ''; |
---|
33 | this.store.reload({params: this.params }); |
---|
34 | this.triggers[0].hide(); |
---|
35 | this.hasSearch = false; |
---|
36 | } |
---|
37 | }, |
---|
38 | |
---|
39 | onTrigger2Click : function(){ |
---|
40 | var v = this.getRawValue(); |
---|
41 | if(v.length < 1){ |
---|
42 | this.onTrigger1Click(); |
---|
43 | return; |
---|
44 | } |
---|
45 | this.store.baseParams = this.store.baseParams || {}; |
---|
46 | this.store.baseParams[this.paramName] = v; |
---|
47 | this.store.reload({params: this.params }); |
---|
48 | this.hasSearch = true; |
---|
49 | this.triggers[0].show(); |
---|
50 | } |
---|
51 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.