diff app/view/proben/List.js @ 374:832e3c8f9191

Implemented dynamic ProbelList model. The model will get initialized by the fields configured in the sql configuration.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 20 Aug 2013 16:50:47 +0200
parents d0f5be50aed5
children eb79d9bf3929
line wrap: on
line diff
--- a/app/view/proben/List.js	Fri Aug 16 16:49:46 2013 +0200
+++ b/app/view/proben/List.js	Tue Aug 20 16:50:47 2013 +0200
@@ -4,7 +4,7 @@
 Ext.define('Lada.view.proben.List' ,{
     extend: 'Ext.grid.Panel',
     alias: 'widget.probenlist',
-    store: 'Proben',
+    store: 'ProbenList',
     viewConfig: {
         maxHeight: 350,
         emptyText: 'Keine Proben gefunden.',
@@ -13,18 +13,6 @@
         minHeight: 35,
         deferEmptyText: false
     },
-    availableColumns: [
-            {header: 'Datenbasis',  dataIndex: 'datenbasisId', width: 70},
-            {header: 'MPL',  dataIndex: 'mplId', width: 50},
-            {header: 'UWB',  dataIndex: 'umwId', width: 50},
-            {header: 'MMT',  dataIndex: 'messmethode'},
-            {header: 'HPNR',  dataIndex: 'hauptprobenNr'},
-            {header: 'NPNR',  dataIndex: 'nebenprobenNr'},
-            {header: 'E.Gemeinde',  dataIndex: 'bezeichnung', flex: 1},
-            {header: 'Ursprungsgemeinde',  dataIndex: 'kreis', flex: 1},
-            {header: 'ProbeID', dataIndex: 'probeId'},
-            {header: 'MST', dataIndex: 'mstId', width: 50}
-    ],
     initComponent: function() {
         this.dockedItems = [
             {
@@ -55,10 +43,15 @@
      */
     setupColumns: function(cols) {
         var rcols = [];
+        var mfields = [];
+
         rcols.push({header: 'RW', dataIndex: 'readonly', width: 30, renderer: render_readonly});
+        mfields.push(new Ext.data.Field({name: 'readonly'}));
         for (var i = cols.length - 1; i >= 0; i--){
             rcols.push(cols[i]);
+            mfields.push(new Ext.data.Field({name: cols[i].dataIndex}));
         }
+        this.store.model.setFields(mfields);
         this.reconfigure(this.store, rcols);
     }
 });

http://lada.wald.intevation.org