X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6:/examples/ux/gridfilters/filter/StringFilter.js..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/examples/ux/grid/filter/StringFilter.js diff --git a/examples/ux/gridfilters/filter/StringFilter.js b/examples/ux/grid/filter/StringFilter.js similarity index 81% rename from examples/ux/gridfilters/filter/StringFilter.js rename to examples/ux/grid/filter/StringFilter.js index e02928c9..71b5a30c 100644 --- a/examples/ux/gridfilters/filter/StringFilter.js +++ b/examples/ux/grid/filter/StringFilter.js @@ -1,32 +1,28 @@ -/*! - * 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 *

Example Usage:

- *
    
-var filters = new Ext.ux.grid.GridFilters({
+ * 

+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
     }]
 });
  * 
*/ -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 @@ -38,8 +34,8 @@ Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, { emptyText: 'Enter Filter Text...', selectOnFocus: true, width: 125, - - /** + + /** * @private * Template method that is to initialize the filter and install required menu items. */ @@ -47,17 +43,23 @@ Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, { 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. @@ -66,12 +68,12 @@ Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.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); @@ -114,8 +116,8 @@ Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, { return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1; }, - - /** + + /** * @private * Handler method called when there is a keyup event on this.inputItem */ @@ -123,7 +125,7 @@ Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, { var k = e.getKey(); if (k == e.RETURN && field.isValid()) { e.stopEvent(); - this.menu.hide(true); + this.menu.hide(); return; } // restart the timer