static/ext/src/ux/grid/FilterBar.js
function(field) {
		if (!field.isValid()) return;
		var me = this,
			grid = me.grid,
			column = me.columns.get(field.dataIndex),
			newVal = (grid.store.remoteFilter ? field.getSubmitValue() : field.getValue());

		if (Ext.isArray(newVal) && newVal.length == 0) {
			newVal = '';
		}
		var myIndex = -1;
		Ext.each(me.filterArray, function(item2, index, allItems) {
			if(item2.property === column.dataIndex) {
				myIndex = index;
			}
		});
		if(myIndex != -1) {
			me.filterArray.splice(myIndex, 1);
		}
		if(!Ext.isEmpty(newVal)) {
			if (!grid.store.remoteFilter) {
				var operator = field.operator || column.filter.operator,
					filterFn;
				switch(operator) {
					case 'eq':
						filterFn = function(item) {
							if (column.filter.type == 'date') {
								return Ext.Date.clearTime(item.get(column.dataIndex), true).getTime() == Ext.Date.clearTime(newVal, true).getTime();
							} else {
								return (Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)) == (Ext.isEmpty(newVal) ? me.autoStoresNullValue : newVal);
							}
						};
						break;
					case 'gte':
						filterFn = function(item) {
							if (column.filter.type == 'date') {
								return Ext.Date.clearTime(item.get(column.dataIndex), true).getTime() >= Ext.Date.clearTime(newVal, true).getTime();
							} else {
								return (Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)) >= (Ext.isEmpty(newVal) ? me.autoStoresNullValue : newVal);
							}
						};
						break;
					case 'lte':
						filterFn = function(item) {
							if (column.filter.type == 'date') {
								return Ext.Date.clearTime(item.get(column.dataIndex), true).getTime() <= Ext.Date.clearTime(newVal, true).getTime();
							} else {
								return (Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)) <= (Ext.isEmpty(newVal) ? me.autoStoresNullValue : newVal);
							}
						};
						break;
					case 'ne':
						filterFn = function(item) {
							if (column.filter.type == 'date') {
								return Ext.Date.clearTime(item.get(column.dataIndex), true).getTime() != Ext.Date.clearTime(newVal, true).getTime();
							} else {
								return (Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)) != (Ext.isEmpty(newVal) ? me.autoStoresNullValue : newVal);
							}
						};
						break;
					case 'like':
						filterFn = function(item) {
							var re = new RegExp(newVal, 'i');
							return re.test(item.get(column.dataIndex));
						};
						break;
					case 'in':
						filterFn = function(item) {
							var re = new RegExp('^' + newVal.join('|') + '$', 'i');
							return re.test((Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)));
						};
						break;
				}
				me.filterArray.push(Ext.create('Ext.util.Filter', {
					property: column.dataIndex,
					filterFn: filterFn,
					me: me
				}));
			} else {
				me.filterArray.push(Ext.create('Ext.util.Filter', {
					property: column.dataIndex,
					value: newVal,
					type: column.filter.type,
					operator: (field.operator || column.filter.operator)
				}));
			}
			if(!column.getEl().hasCls(me.columnFilteredCls)) {
				column.getEl().addCls(me.columnFilteredCls);
			}
		} else {
			if(column.getEl().hasCls(me.columnFilteredCls)) {
				column.getEl().removeCls(me.columnFilteredCls);
			}
		}
		grid.store.currentPage = 1;
		if(me.filterArray.length > 0) {
			if (!grid.store.remoteFilter) grid.store.clearFilter();
			grid.store.filters.clear();
			grid.store.filter(me.filterArray);
			if (me.clearAllEl) {
				me.clearAllEl.show({duration: 1000});
			}
		} else {
			grid.store.clearFilter();
			if (me.clearAllEl) {
				me.clearAllEl.hide({duration: 1000});
			}
		}
		if (!grid.store.remoteFilter && me.autoUpdateAutoStores) {
			me.fillAutoStores();
		}
		me.fireEvent('filterupdated', me.filterArray);
	}
function(field) {
		if (!field.isValid()) return;
		var me = this,
			grid = me.grid,
			column = me.columns.get(field.dataIndex),
			newVal = (grid.store.remoteFilter ? field.getSubmitValue() : field.getValue());

		if (Ext.isArray(newVal) && newVal.length == 0) {
			newVal = '';
		}
		var myIndex = -1;
		Ext.each(me.filterArray, function(item2, index, allItems) {
			if(item2.property === column.dataIndex) {
				myIndex = index;
			}
		});
		if(myIndex != -1) {
			me.filterArray.splice(myIndex, 1);
		}
		if(!Ext.isEmpty(newVal)) {
			if (!grid.store.remoteFilter) {
				var operator = field.operator || column.filter.operator,
					filterFn;
				switch(operator) {
					case 'eq':
						filterFn = function(item) {
							if (column.filter.type == 'date') {
								return Ext.Date.clearTime(item.get(column.dataIndex), true).getTime() == Ext.Date.clearTime(newVal, true).getTime();
							} else {
								return (Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)) == (Ext.isEmpty(newVal) ? me.autoStoresNullValue : newVal);
							}
						};
						break;
					case 'gte':
						filterFn = function(item) {
							if (column.filter.type == 'date') {
								return Ext.Date.clearTime(item.get(column.dataIndex), true).getTime() >= Ext.Date.clearTime(newVal, true).getTime();
							} else {
								return (Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)) >= (Ext.isEmpty(newVal) ? me.autoStoresNullValue : newVal);
							}
						};
						break;
					case 'lte':
						filterFn = function(item) {
							if (column.filter.type == 'date') {
								return Ext.Date.clearTime(item.get(column.dataIndex), true).getTime() <= Ext.Date.clearTime(newVal, true).getTime();
							} else {
								return (Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)) <= (Ext.isEmpty(newVal) ? me.autoStoresNullValue : newVal);
							}
						};
						break;
					case 'ne':
						filterFn = function(item) {
							if (column.filter.type == 'date') {
								return Ext.Date.clearTime(item.get(column.dataIndex), true).getTime() != Ext.Date.clearTime(newVal, true).getTime();
							} else {
								return (Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)) != (Ext.isEmpty(newVal) ? me.autoStoresNullValue : newVal);
							}
						};
						break;
					case 'like':
						filterFn = function(item) {
							var re = new RegExp(newVal, 'i');
							return re.test(item.get(column.dataIndex));
						};
						break;
					case 'in':
						filterFn = function(item) {
							var re = new RegExp('^' + newVal.join('|') + '$', 'i');
							return re.test((Ext.isEmpty(item.get(column.dataIndex)) ? me.autoStoresNullValue : item.get(column.dataIndex)));
						};
						break;
				}
				me.filterArray.push(Ext.create('Ext.util.Filter', {
					property: column.dataIndex,
					filterFn: filterFn,
					me: me
				}));
			} else {
				me.filterArray.push(Ext.create('Ext.util.Filter', {
					property: column.dataIndex,
					value: newVal,
					type: column.filter.type,
					operator: (field.operator || column.filter.operator)
				}));
			}
			if(!column.getEl().hasCls(me.columnFilteredCls)) {
				column.getEl().addCls(me.columnFilteredCls);
			}
		} else {
			if(column.getEl().hasCls(me.columnFilteredCls)) {
				column.getEl().removeCls(me.columnFilteredCls);
			}
		}
		grid.store.currentPage = 1;
		if(me.filterArray.length > 0) {
			if (!grid.store.remoteFilter) grid.store.clearFilter();
			grid.store.filters.clear();
			grid.store.filter(me.filterArray);
			if (me.clearAllEl) {
				me.clearAllEl.show({duration: 1000});
			}
		} else {
			grid.store.clearFilter();
			if (me.clearAllEl) {
				me.clearAllEl.hide({duration: 1000});
			}
		}
		if (!grid.store.remoteFilter && me.autoUpdateAutoStores) {
			me.fillAutoStores();
		}
		me.fireEvent('filterupdated', me.filterArray);
	}
function ( field ) { if ( ! field . isValid ( ) ) return ; var me = this , grid = me . grid , column = me . columns . get ( field . dataIndex ) , newVal = ( grid . store . remoteFilter ? field . getSubmitValue ( ) : field . getValue ( ) ) ; if ( Ext . isArray ( newVal ) && newVal . length == 0 ) { newVal = '' ; } var myIndex = - 1 ; Ext . each ( me . filterArray , function ( item2 , index , allItems ) { if ( item2 . property === column . dataIndex ) { myIndex = index ; } } ) ; if ( myIndex != - 1 ) { me . filterArray . splice ( myIndex , 1 ) ; } if ( ! Ext . isEmpty ( newVal ) ) { if ( ! grid . store . remoteFilter ) { var operator = field . operator || column . filter . operator , filterFn ; switch ( operator ) { case 'eq' : filterFn = function ( item ) { if ( column . filter . type == 'date' ) { return Ext . Date . clearTime ( item . get ( column . dataIndex ) , true ) . getTime ( ) == Ext . Date . clearTime ( newVal , true ) . getTime ( ) ; } else { return ( Ext . isEmpty ( item . get ( column . dataIndex ) ) ? me . autoStoresNullValue : item . get ( column . dataIndex ) ) == ( Ext . isEmpty ( newVal ) ? me . autoStoresNullValue : newVal ) ; } } ; break ; case 'gte' : filterFn = function ( item ) { if ( column . filter . type == 'date' ) { return Ext . Date . clearTime ( item . get ( column . dataIndex ) , true ) . getTime ( ) >= Ext . Date . clearTime ( newVal , true ) . getTime ( ) ; } else { return ( Ext . isEmpty ( item . get ( column . dataIndex ) ) ? me . autoStoresNullValue : item . get ( column . dataIndex ) ) >= ( Ext . isEmpty ( newVal ) ? me . autoStoresNullValue : newVal ) ; } } ; break ; case 'lte' : filterFn = function ( item ) { if ( column . filter . type == 'date' ) { return Ext . Date . clearTime ( item . get ( column . dataIndex ) , true ) . getTime ( ) <= Ext . Date . clearTime ( newVal , true ) . getTime ( ) ; } else { return ( Ext . isEmpty ( item . get ( column . dataIndex ) ) ? me . autoStoresNullValue : item . get ( column . dataIndex ) ) <= ( Ext . isEmpty ( newVal ) ? me . autoStoresNullValue : newVal ) ; } } ; break ; case 'ne' : filterFn = function ( item ) { if ( column . filter . type == 'date' ) { return Ext . Date . clearTime ( item . get ( column . dataIndex ) , true ) . getTime ( ) != Ext . Date . clearTime ( newVal , true ) . getTime ( ) ; } else { return ( Ext . isEmpty ( item . get ( column . dataIndex ) ) ? me . autoStoresNullValue : item . get ( column . dataIndex ) ) != ( Ext . isEmpty ( newVal ) ? me . autoStoresNullValue : newVal ) ; } } ; break ; case 'like' : filterFn = function ( item ) { var re = new RegExp ( newVal , 'i' ) ; return re . test ( item . get ( column . dataIndex ) ) ; } ; break ; case 'in' : filterFn = function ( item ) { var re = new RegExp ( '^' + newVal . join ( '|' ) + '$' , 'i' ) ; return re . test ( ( Ext . isEmpty ( item . get ( column . dataIndex ) ) ? me . autoStoresNullValue : item . get ( column . dataIndex ) ) ) ; } ; break ; } me . filterArray . push ( Ext . create ( 'Ext.util.Filter' , { property : column . dataIndex , filterFn : filterFn , me : me } ) ) ; } else { me . filterArray . push ( Ext . create ( 'Ext.util.Filter' , { property : column . dataIndex , value : newVal , type : column . filter . type , operator : ( field . operator || column . filter . operator ) } ) ) ; } if ( ! column . getEl ( ) . hasCls ( me . columnFilteredCls ) ) { column . getEl ( ) . addCls ( me . columnFilteredCls ) ; } } else { if ( column . getEl ( ) . hasCls ( me . columnFilteredCls ) ) { column . getEl ( ) . removeCls ( me . columnFilteredCls ) ; } } grid . store . currentPage = 1 ; if ( me . filterArray . length > 0 ) { if ( ! grid . store . remoteFilter ) grid . store . clearFilter ( ) ; grid . store . filters . clear ( ) ; grid . store . filter ( me . filterArray ) ; if ( me . clearAllEl ) { me . clearAllEl . show ( { duration : 1000 } ) ; } } else { grid . store . clearFilter ( ) ; if ( me . clearAllEl ) { me . clearAllEl . hide ( { duration : 1000 } ) ; } } if ( ! grid . store . remoteFilter && me . autoUpdateAutoStores ) { me . fillAutoStores ( ) ; } me . fireEvent ( 'filterupdated' , me . filterArray ) ; }
private
private