X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..6a7e4474cba9d8be4b2ec445e10f1691f7277c50:/examples/ux/gridfilters/filter/StringFilter.js?ds=sidebyside diff --git a/examples/ux/gridfilters/filter/StringFilter.js b/examples/ux/gridfilters/filter/StringFilter.js index 40ccbb57..44ea774e 100644 --- a/examples/ux/gridfilters/filter/StringFilter.js +++ b/examples/ux/gridfilters/filter/StringFilter.js @@ -1,132 +1,132 @@ /*! - * Ext JS Library 3.0.3 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.2.0 + * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license */ -/** - * @class Ext.ux.grid.filter.StringFilter - * @extends Ext.ux.grid.filter.Filter - * Filter by a configurable Ext.form.TextField - *
Example Usage:
- *
-var filters = new Ext.ux.grid.GridFilters({
- ...
- filters: [{
- // required configs
- type: 'string',
- dataIndex: 'name',
-
- // optional configs
- value: 'foo',
- active: true, // default is false
- iconCls: 'ux-gridfilter-text-icon' // default
- // any Ext.form.TextField configs accepted
- }]
-});
- *
- */
-Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
-
- /**
- * @cfg {String} iconCls
- * The iconCls to be applied to the menu item.
- * Defaults to 'ux-gridfilter-text-icon'.
- */
- iconCls : 'ux-gridfilter-text-icon',
-
- emptyText: 'Enter Filter Text...',
- selectOnFocus: true,
- width: 125,
-
- /**
- * @private
- * Template method that is to initialize the filter and install required menu items.
- */
- init : function (config) {
- Ext.applyIf(config, {
- enableKeyEvents: true,
- iconCls: this.iconCls,
- listeners: {
- scope: this,
- keyup: this.onInputKeyUp
- }
- });
-
- this.inputItem = new Ext.form.TextField(config);
- this.menu.add(this.inputItem);
- this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this);
- },
-
- /**
- * @private
- * Template method that is to get and return the value of the filter.
- * @return {String} The value of this filter
- */
- getValue : function () {
- return this.inputItem.getValue();
- },
-
- /**
- * @private
- * Template method that is to set the value of the filter.
- * @param {Object} value The value to set the filter
- */
- setValue : function (value) {
- this.inputItem.setValue(value);
- this.fireEvent('update', this);
- },
-
- /**
- * @private
- * Template method that is to return true if the filter
- * has enough configuration information to be activated.
- * @return {Boolean}
- */
- isActivatable : function () {
- return this.inputItem.getValue().length > 0;
- },
-
- /**
- * @private
- * Template method that is to get and return serialized filter data for
- * transmission to the server.
- * @return {Object/Array} An object or collection of objects containing
- * key value pairs representing the current configuration of the filter.
- */
- getSerialArgs : function () {
- return {type: 'string', value: this.getValue()};
- },
-
- /**
- * Template method that is to validate the provided Ext.data.Record
- * against the filters configuration.
- * @param {Ext.data.Record} record The record to validate
- * @return {Boolean} true if the record is valid within the bounds
- * of the filter, false otherwise.
- */
- validateRecord : function (record) {
- var val = record.get(this.dataIndex);
-
- if(typeof val != 'string') {
- return (this.getValue().length === 0);
- }
-
- return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
- },
-
- /**
- * @private
- * Handler method called when there is a keyup event on this.inputItem
- */
- onInputKeyUp : function (field, e) {
- var k = e.getKey();
- if (k == e.RETURN && field.isValid()) {
- e.stopEvent();
- this.menu.hide(true);
- return;
- }
- // restart the timer
- this.updateTask.delay(this.updateBuffer);
- }
-});
+/**
+ * @class Ext.ux.grid.filter.StringFilter
+ * @extends Ext.ux.grid.filter.Filter
+ * Filter by a configurable Ext.form.TextField
+ * Example Usage:
+ *
+var filters = new Ext.ux.grid.GridFilters({
+ ...
+ filters: [{
+ // required configs
+ type: 'string',
+ dataIndex: 'name',
+
+ // optional configs
+ value: 'foo',
+ active: true, // default is false
+ iconCls: 'ux-gridfilter-text-icon' // default
+ // any Ext.form.TextField configs accepted
+ }]
+});
+ *
+ */
+Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
+
+ /**
+ * @cfg {String} iconCls
+ * The iconCls to be applied to the menu item.
+ * Defaults to 'ux-gridfilter-text-icon'.
+ */
+ iconCls : 'ux-gridfilter-text-icon',
+
+ emptyText: 'Enter Filter Text...',
+ selectOnFocus: true,
+ width: 125,
+
+ /**
+ * @private
+ * Template method that is to initialize the filter and install required menu items.
+ */
+ init : function (config) {
+ Ext.applyIf(config, {
+ enableKeyEvents: true,
+ iconCls: this.iconCls,
+ listeners: {
+ scope: this,
+ keyup: this.onInputKeyUp
+ }
+ });
+
+ this.inputItem = new Ext.form.TextField(config);
+ this.menu.add(this.inputItem);
+ this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this);
+ },
+
+ /**
+ * @private
+ * Template method that is to get and return the value of the filter.
+ * @return {String} The value of this filter
+ */
+ getValue : function () {
+ return this.inputItem.getValue();
+ },
+
+ /**
+ * @private
+ * Template method that is to set the value of the filter.
+ * @param {Object} value The value to set the filter
+ */
+ setValue : function (value) {
+ this.inputItem.setValue(value);
+ this.fireEvent('update', this);
+ },
+
+ /**
+ * @private
+ * Template method that is to return true if the filter
+ * has enough configuration information to be activated.
+ * @return {Boolean}
+ */
+ isActivatable : function () {
+ return this.inputItem.getValue().length > 0;
+ },
+
+ /**
+ * @private
+ * Template method that is to get and return serialized filter data for
+ * transmission to the server.
+ * @return {Object/Array} An object or collection of objects containing
+ * key value pairs representing the current configuration of the filter.
+ */
+ getSerialArgs : function () {
+ return {type: 'string', value: this.getValue()};
+ },
+
+ /**
+ * Template method that is to validate the provided Ext.data.Record
+ * against the filters configuration.
+ * @param {Ext.data.Record} record The record to validate
+ * @return {Boolean} true if the record is valid within the bounds
+ * of the filter, false otherwise.
+ */
+ validateRecord : function (record) {
+ var val = record.get(this.dataIndex);
+
+ if(typeof val != 'string') {
+ return (this.getValue().length === 0);
+ }
+
+ return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
+ },
+
+ /**
+ * @private
+ * Handler method called when there is a keyup event on this.inputItem
+ */
+ onInputKeyUp : function (field, e) {
+ var k = e.getKey();
+ if (k == e.RETURN && field.isValid()) {
+ e.stopEvent();
+ this.menu.hide(true);
+ return;
+ }
+ // restart the timer
+ this.updateTask.delay(this.updateBuffer);
+ }
+});