2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
9 Ext.grid.filter.StringFilter = Ext.extend(Ext.grid.filter.Filter, {
\r
11 icon: '/img/small_icons/famfamfam/find.png',
\r
14 var value = this.value = new Ext.menu.EditableItem({icon: this.icon});
\r
15 value.on('keyup', this.onKeyUp, this);
\r
16 this.menu.add(value);
\r
18 this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this);
\r
21 onKeyUp: function(event) {
\r
22 if(event.getKey() == event.ENTER){
\r
23 this.menu.hide(true);
\r
26 this.updateTask.delay(this.updateBuffer);
\r
29 isActivatable: function() {
\r
30 return this.value.getValue().length > 0;
\r
33 fireUpdate: function() {
\r
35 this.fireEvent("update", this);
\r
37 this.setActive(this.isActivatable());
\r
40 setValue: function(value) {
\r
41 this.value.setValue(value);
\r
42 this.fireEvent("update", this);
\r
45 getValue: function() {
\r
46 return this.value.getValue();
\r
49 serialize: function() {
\r
50 var args = {type: 'string', value: this.getValue()};
\r
51 this.fireEvent('serialize', args, this);
\r
55 validateRecord: function(record) {
\r
56 var val = record.get(this.dataIndex);
\r
57 if(typeof val != "string") {
\r
58 return this.getValue().length == 0;
\r
60 return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
\r