annotate app/override/StringFilter.js @ 1424:44d28e46cc4b

Use latest server version.
author Tom Gottfried <tom@intevation.de>
date Thu, 06 Apr 2017 12:13:45 +0200
parents 6075731bc4f1
children
rev   line source
1308
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.override.StringFilter', {
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 override: 'Ext.ux.grid.filter.StringFilter',
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 validateRecord: function(record) {
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 if (this.dataIndex === 'gemId') {
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 var store = Ext.data.StoreManager.get('verwaltungseinheiten');
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 var item = store.getById(record.get('gemId'));
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 var comp = item.get('bezeichnung');
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 return comp.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 }
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 else if (this.dataIndex === 'staatId') {
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 var store = Ext.data.StoreManager.get('staaten');
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 var item = store.getById(record.get('staatId'));
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 var comp = item.get('staatIso');
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 return comp.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 }
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 else {
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 var val = record.get(this.dataIndex);
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 if(typeof val != 'string') {
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 return (this.getValue().length === 0);
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 }
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 }
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 }
6075731bc4f1 Added column filter to orte grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 });

http://lada.wald.intevation.org