-/*!
- * Ext JS Library 3.3.1
- * Copyright(c) 2006-2010 Sencha Inc.
- * licensing@sencha.com
- * http://www.sencha.com/license
- */
-/**
+/**
* @class Ext.ux.grid.filter.StringFilter
* @extends Ext.ux.grid.filter.Filter
- * Filter by a configurable Ext.form.TextField
+ * Filter by a configurable Ext.form.field.Text
* <p><b><u>Example Usage:</u></b></p>
- * <pre><code>
-var filters = new Ext.ux.grid.GridFilters({
+ * <pre><code>
+var filters = Ext.create('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
+ // any Ext.form.field.Text configs accepted
}]
});
* </code></pre>
*/
-Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
+Ext.define('Ext.ux.grid.filter.StringFilter', {
+ extend: 'Ext.ux.grid.filter.Filter',
+ alias: 'gridfilter.string',
/**
* @cfg {String} iconCls
emptyText: 'Enter Filter Text...',
selectOnFocus: true,
width: 125,
-
- /**
+
+ /**
* @private
* Template method that is to initialize the filter and install required menu items.
*/
Ext.applyIf(config, {
enableKeyEvents: true,
iconCls: this.iconCls,
+ hideLabel: true,
listeners: {
scope: this,
- keyup: this.onInputKeyUp
+ keyup: this.onInputKeyUp,
+ el: {
+ click: function(e) {
+ e.stopPropagation();
+ }
+ }
}
});
- this.inputItem = new Ext.form.TextField(config);
+ this.inputItem = Ext.create('Ext.form.field.Text', config);
this.menu.add(this.inputItem);
- this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this);
+ this.updateTask = Ext.create('Ext.util.DelayedTask', this.fireUpdate, this);
},
-
+
/**
* @private
* Template method that is to get and return the value of the 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);
return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
},
-
- /**
+
+ /**
* @private
* Handler method called when there is a keyup event on this.inputItem
*/
var k = e.getKey();
if (k == e.RETURN && field.isValid()) {
e.stopEvent();
- this.menu.hide(true);
+ this.menu.hide();
return;
}
// restart the timer