[Lada-commits] [PATCH] Implemented dynamic ProbelList model. The model will get initialized by the

Wald Commits scm-commit at wald.intevation.org
Tue Aug 20 16:52:23 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1377010247 -7200
# Node ID 832e3c8f919198ce9a87085663ef194bbaef0aad
# Parent  9b663418b61477c408881024a4804b4475780a57
Implemented dynamic ProbelList model. The model will get initialized by the
fields configured in the sql configuration.

diff -r 9b663418b614 -r 832e3c8f9191 app/controller/Sql.js
--- a/app/controller/Sql.js	Fri Aug 16 16:49:46 2013 +0200
+++ b/app/controller/Sql.js	Tue Aug 20 16:50:47 2013 +0200
@@ -8,6 +8,7 @@
     extend: 'Ext.app.Controller',
     stores: [
         'Proben',    // List of found Proben
+        'ProbenList',    // List of found Proben
         'Queries'
     ],
     requires: [
diff -r 9b663418b614 -r 832e3c8f9191 app/model/ProbeList.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/model/ProbeList.js	Tue Aug 20 16:50:47 2013 +0200
@@ -0,0 +1,20 @@
+/**
+ * A ProbeList.
+ * This class represents the result list of "Proben" in the search query
+ * */
+Ext.define('Lada.model.ProbeList', {
+    extend: 'Lada.model.Base',
+    fields: [
+        {name: "readonly"}
+    ],
+    idProperty: "probeId",
+    proxy: {
+        type: 'rest',
+        appendId: true, //default
+        url: 'server/rest/proben',
+        reader: {
+            type: 'json',
+            root: 'data'
+        }
+    }
+});
diff -r 9b663418b614 -r 832e3c8f9191 app/store/ProbenList.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/store/ProbenList.js	Tue Aug 20 16:50:47 2013 +0200
@@ -0,0 +1,7 @@
+/**
+ * Store for Proben
+ */
+Ext.define('Lada.store.ProbenList', {
+    extend: 'Ext.data.Store',
+    model: 'Lada.model.ProbeList'
+});
diff -r 9b663418b614 -r 832e3c8f9191 app/view/proben/List.js
--- 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);
     }
 });


More information about the Lada-commits mailing list