+++ /dev/null
-<html>
-<head>
- <title>The source code</title>
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
-</head>
-<body onload="prettyPrint();">
- <pre class="prettyprint lang-js">Ext.ns('Ext.ux.form');\r
-\r
-Ext.ux.form.SearchField = Ext.extend(Ext.form.TwinTriggerField, {\r
- initComponent : function(){\r
- Ext.ux.form.SearchField.superclass.initComponent.call(this);\r
- this.on('specialkey', function(f, e){\r
- if(e.getKey() == e.ENTER){\r
- this.onTrigger2Click();\r
- }\r
- }, this);\r
- },\r
-\r
- validationEvent:false,\r
- validateOnBlur:false,\r
- trigger1Class:'x-form-clear-trigger',\r
- trigger2Class:'x-form-search-trigger',\r
- hideTrigger1:true,\r
- width:180,\r
- hasSearch : false,\r
- paramName : 'query',\r
-\r
- onTrigger1Click : function(){\r
- if(this.hasSearch){\r
- this.el.dom.value = '';\r
- var o = {start: 0};\r
- this.store.baseParams = this.store.baseParams || {};\r
- this.store.baseParams[this.paramName] = '';\r
- this.store.reload({params:o});\r
- this.triggers[0].hide();\r
- this.hasSearch = false;\r
- }\r
- },\r
-\r
- onTrigger2Click : function(){\r
- var v = this.getRawValue();\r
- if(v.length < 1){\r
- this.onTrigger1Click();\r
- return;\r
- }\r
- var o = {start: 0};\r
- this.store.baseParams = this.store.baseParams || {};\r
- this.store.baseParams[this.paramName] = v;\r
- this.store.reload({params:o});\r
- this.hasSearch = true;\r
- this.triggers[0].show();\r
- }\r
-});</pre>
-</body>
-</html>
\ No newline at end of file