Mercurial > lada > lada-client
diff app/override/StringFilter.js @ 1308:6075731bc4f1
Added column filter to orte grid.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 02 Feb 2017 16:43:53 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/override/StringFilter.js Thu Feb 02 16:43:53 2017 +0100 @@ -0,0 +1,33 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +Ext.define('Lada.override.StringFilter', { + override: 'Ext.ux.grid.filter.StringFilter', + + validateRecord: function(record) { + if (this.dataIndex === 'gemId') { + var store = Ext.data.StoreManager.get('verwaltungseinheiten'); + var item = store.getById(record.get('gemId')); + var comp = item.get('bezeichnung'); + return comp.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1; + } + else if (this.dataIndex === 'staatId') { + var store = Ext.data.StoreManager.get('staaten'); + var item = store.getById(record.get('staatId')); + var comp = item.get('staatIso'); + return comp.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1; + } + else { + var val = record.get(this.dataIndex); + if(typeof val != 'string') { + return (this.getValue().length === 0); + } + return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1; + } + } +});