--- /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"><div id="cls-Ext.ux.grid.filter.StringFilter"></div>/** \r
+ * @class Ext.ux.grid.filter.StringFilter\r
+ * @extends Ext.ux.grid.filter.Filter\r
+ * Filter by a configurable Ext.form.TextField\r
+ * <p><b><u>Example Usage:</u></b></p>\r
+ * <pre><code> \r
+var filters = new Ext.ux.grid.GridFilters({\r
+ ...\r
+ filters: [{\r
+ // required configs\r
+ type: 'string',\r
+ dataIndex: 'name',\r
+ \r
+ // optional configs\r
+ value: 'foo',\r
+ active: true, // default is false\r
+ iconCls: 'ux-gridfilter-text-icon' // default\r
+ // any Ext.form.TextField configs accepted\r
+ }]\r
+});\r
+ * </code></pre>\r
+ */\r
+Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, {\r
+\r
+ <div id="cfg-Ext.ux.grid.filter.StringFilter-iconCls"></div>/**\r
+ * @cfg {String} iconCls\r
+ * The iconCls to be applied to the menu item.\r
+ * Defaults to <tt>'ux-gridfilter-text-icon'</tt>.\r
+ */\r
+ iconCls : 'ux-gridfilter-text-icon',\r
+\r
+ emptyText: 'Enter Filter Text...',\r
+ selectOnFocus: true,\r
+ width: 125,\r
+ \r
+ /** \r
+ * @private\r
+ * Template method that is to initialize the filter and install required menu items.\r
+ */\r
+ init : function (config) {\r
+ Ext.applyIf(config, {\r
+ enableKeyEvents: true,\r
+ iconCls: this.iconCls,\r
+ listeners: {\r
+ scope: this,\r
+ keyup: this.onInputKeyUp\r
+ }\r
+ });\r
+\r
+ this.inputItem = new Ext.form.TextField(config); \r
+ this.menu.add(this.inputItem);\r
+ this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this);\r
+ },\r
+ \r
+ /**\r
+ * @private\r
+ * Template method that is to get and return the value of the filter.\r
+ * @return {String} The value of this filter\r
+ */\r
+ getValue : function () {\r
+ return this.inputItem.getValue();\r
+ },\r
+ \r
+ /**\r
+ * @private\r
+ * Template method that is to set the value of the filter.\r
+ * @param {Object} value The value to set the filter\r
+ */ \r
+ setValue : function (value) {\r
+ this.inputItem.setValue(value);\r
+ this.fireEvent('update', this);\r
+ },\r
+\r
+ /**\r
+ * @private\r
+ * Template method that is to return <tt>true</tt> if the filter\r
+ * has enough configuration information to be activated.\r
+ * @return {Boolean}\r
+ */\r
+ isActivatable : function () {\r
+ return this.inputItem.getValue().length > 0;\r
+ },\r
+\r
+ /**\r
+ * @private\r
+ * Template method that is to get and return serialized filter data for\r
+ * transmission to the server.\r
+ * @return {Object/Array} An object or collection of objects containing\r
+ * key value pairs representing the current configuration of the filter.\r
+ */\r
+ getSerialArgs : function () {\r
+ return {type: 'string', value: this.getValue()};\r
+ },\r
+\r
+ <div id="method-Ext.ux.grid.filter.StringFilter-validateRecord"></div>/**\r
+ * Template method that is to validate the provided Ext.data.Record\r
+ * against the filters configuration.\r
+ * @param {Ext.data.Record} record The record to validate\r
+ * @return {Boolean} true if the record is valid within the bounds\r
+ * of the filter, false otherwise.\r
+ */\r
+ validateRecord : function (record) {\r
+ var val = record.get(this.dataIndex);\r
+\r
+ if(typeof val != 'string') {\r
+ return (this.getValue().length === 0);\r
+ }\r
+\r
+ return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;\r
+ },\r
+ \r
+ /** \r
+ * @private\r
+ * Handler method called when there is a keyup event on this.inputItem\r
+ */\r
+ onInputKeyUp : function (field, e) {\r
+ var k = e.getKey();\r
+ if (k == e.RETURN && field.isValid()) {\r
+ e.stopEvent();\r
+ this.menu.hide(true);\r
+ return;\r
+ }\r
+ // restart the timer\r
+ this.updateTask.delay(this.updateBuffer);\r
+ }\r
+});\r
+</pre>
+</body>
+</html>
\ No newline at end of file