diff app/view/grid/Orte.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 5dfd5798cbcc
children 46093e6f45d2
line wrap: on
line diff
--- a/app/view/grid/Orte.js	Thu Feb 02 15:46:05 2017 +0100
+++ b/app/view/grid/Orte.js	Thu Feb 02 16:43:53 2017 +0100
@@ -13,6 +13,9 @@
     extend: 'Ext.grid.Panel',
     alias: 'widget.ortstammdatengrid',
 
+    requires: [
+        'Ext.ux.grid.FiltersFeature'
+    ],
     // minHeight and deferEmptyText are needed to be able to show the
     // emptyText message.
     minHeight: 110,
@@ -27,6 +30,7 @@
     readOnly: true,
     allowDeselect: true,
     editableGrid: true,
+    features: [],
 
     initComponent: function() {
         var i18n = Lada.getApplication().bundle;
@@ -42,6 +46,21 @@
             this.plugins = [this.rowEditing];
         }
 
+        filters = {
+            ftype: 'filters',
+            // encode and local configuration options defined previously for easier reuse
+            encode: false, // json encode the filter query
+            local: true,   // defaults to false (remote filtering)
+
+            // Filters are most naturally placed in the column definition, but can also be
+            // added here.
+            filters: [{
+                type: 'boolean',
+                dataIndex: 'visible'
+            }]
+        };
+        this.features = [filters];
+
         this.columns = [{
             xtype: 'actioncolumn',
             text: 'RW',
@@ -83,6 +102,9 @@
                 maxLength: 10,
                 allowBlank: false
             },
+            filter: {
+                type: 'string'
+            },
             dataIndex: 'ortId'
         }, {
             header: i18n.getMsg('orte.nutsCode'),
@@ -90,6 +112,9 @@
                 xtype: 'textfield',
                 maxLength: 10
             },
+            filter: {
+                type: 'string'
+            },
             dataIndex: 'nutsCode'
         }, {
             header: i18n.getMsg('orte.anlageId'),
@@ -101,6 +126,9 @@
             header: i18n.getMsg('orte.verwaltungseinheit'),
             dataIndex: 'gemId',
             width: 120,
+            filter: {
+                type: 'string'
+            },
             renderer: function(value) {
                 if (!value) {
                     return '';
@@ -120,6 +148,9 @@
             header: i18n.getMsg('orte.staatId'),
             dataIndex: 'staatId',
             width: 70,
+            filter: {
+                type: 'string'
+            },
             renderer: function(value) {
                 if (value === undefined || value === '') {
                     return '';
@@ -137,6 +168,9 @@
             }
         }, {
             header: i18n.getMsg('orte.kdaId'),
+            filter: {
+                type: 'numeric'
+            },
             editor: {
                 xtype: 'numberfield',
                 allowBlank: false
@@ -144,12 +178,21 @@
             dataIndex: 'kdaId'
         }, {
             header: i18n.getMsg('orte.ozId'),
+            filter: {
+                type: 'string'
+            },
             dataIndex: 'ozId'
         }, {
             header: i18n.getMsg('orte.ortTyp'),
+            filter: {
+                type: 'numeric'
+            },
             dataIndex: 'ortTyp'
         }, {
             header: i18n.getMsg('orte.mpArt'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 10
@@ -157,6 +200,9 @@
             dataIndex: 'mpArt'
         }, {
             header: i18n.getMsg('orte.zone'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 1
@@ -164,6 +210,9 @@
             dataIndex: 'zone'
         }, {
             header: i18n.getMsg('orte.sektor'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 2
@@ -171,6 +220,9 @@
             dataIndex: 'sektor'
         }, {
             header: i18n.getMsg('orte.zustaendigkeit'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 10
@@ -178,6 +230,9 @@
             dataIndex: 'zustaendigkeit'
         }, {
             header: i18n.getMsg('orte.berichtstext'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 70
@@ -185,6 +240,9 @@
             dataIndex: 'berichtstext'
         }, {
             header: i18n.getMsg('orte.kurztext'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 15,
@@ -193,6 +251,9 @@
             dataIndex: 'kurztext'
         }, {
             header: i18n.getMsg('orte.langtext'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 100,
@@ -201,18 +262,27 @@
             dataIndex: 'langtext'
         }, {
             header: i18n.getMsg('orte.unscharf'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield'
             },
             dataIndex: 'unscharf'
         }, {
             header: i18n.getMsg('orte.hoeheLand'),
+            filter: {
+                type: 'numeric'
+            },
             editor: {
                 xtype: 'numberfield'
             },
             dataIndex: 'hoeheLand'
         }, {
             header: i18n.getMsg('orte.koordXExtern'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 22,
@@ -221,6 +291,9 @@
             dataIndex: 'koordXExtern'
         }, {
             header: i18n.getMsg('orte.koordYExtern'),
+            filter: {
+                type: 'string'
+            },
             editor: {
                 xtype: 'textfield',
                 maxLength: 22,
@@ -229,18 +302,27 @@
             dataIndex: 'koordYExtern'
         }, {
             header: i18n.getMsg('orte.longitude'),
+            filter: {
+                type: 'numeric'
+            },
             editor: {
                 xtype: 'numberfield'
             },
             dataIndex: 'longitude'
         }, {
             header: i18n.getMsg('orte.latitude'),
+            filter: {
+                type: 'numeric'
+            },
             editor: {
                 xtype: 'numberfield'
             },
             dataIndex: 'latitude'
         }, {
             header: i18n.getMsg('letzteAenderung'),
+            filter: {
+                type: 'date'
+            },
             xtype: 'datecolumn',
             format: 'd.m.Y H:i',
             dataIndex: 'letzteAenderung'

http://lada.wald.intevation.org