Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / SearchField.html
diff --git a/docs/source/SearchField.html b/docs/source/SearchField.html
new file mode 100644 (file)
index 0000000..cda1cbb
--- /dev/null
@@ -0,0 +1,56 @@
+<html>\r
+<head>\r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <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>    \r
+</body>\r
+</html>
\ No newline at end of file