3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">Ext.ns('Ext.ux.form');
\r
10 Ext.ux.form.SearchField = Ext.extend(Ext.form.TwinTriggerField, {
\r
11 initComponent : function(){
\r
12 Ext.ux.form.SearchField.superclass.initComponent.call(this);
\r
13 this.on('specialkey', function(f, e){
\r
14 if(e.getKey() == e.ENTER){
\r
15 this.onTrigger2Click();
\r
20 validationEvent:false,
\r
21 validateOnBlur:false,
\r
22 trigger1Class:'x-form-clear-trigger',
\r
23 trigger2Class:'x-form-search-trigger',
\r
27 paramName : 'query',
\r
29 onTrigger1Click : function(){
\r
31 this.el.dom.value = '';
\r
33 this.store.baseParams = this.store.baseParams || {};
\r
34 this.store.baseParams[this.paramName] = '';
\r
35 this.store.reload({params:o});
\r
36 this.triggers[0].hide();
\r
37 this.hasSearch = false;
\r
41 onTrigger2Click : function(){
\r
42 var v = this.getRawValue();
\r
44 this.onTrigger1Click();
\r
48 this.store.baseParams = this.store.baseParams || {};
\r
49 this.store.baseParams[this.paramName] = v;
\r
50 this.store.reload({params:o});
\r
51 this.hasSearch = true;
\r
52 this.triggers[0].show();
\r