diff app/view/grid/Status.js @ 945:023e622f9551

Added the ability to work with "StatusWerten" which are delivered by the lada-server. To enable the uses of StatusWerte, the controller for the status grid, needed to be extended. In addition, the form and grid views of Messung and Status were updated.
author Dustin Demuth <dustin@intevation.de>
date Tue, 27 Oct 2015 16:46:58 +0100
parents 1f1467713c3f
children c7bf0b459074
line wrap: on
line diff
--- a/app/view/grid/Status.js	Fri Oct 16 08:15:36 2015 +0200
+++ b/app/view/grid/Status.js	Tue Oct 27 16:46:58 2015 +0100
@@ -28,14 +28,14 @@
         this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
             clicksToMoveEditor: 1,
             autoCancel: false,
-            disabled: false,
+            disabled: true,
             pluginId: 'rowedit',
             listeners:{
                 // Make row ineditable when readonly is set to true
                 // Normally this would belong into a controller an not the view.
                 // But the RowEditPlugin is not handled there.
                 beforeedit: function(e, o) {
-                    var readonlywin = o.grid.up('window').record.get('readonly');
+                var readonlywin = o.grid.up('window').record.get('readonly');
                     var readonlygrid = o.record.get('readonly');
                     if (readonlywin == true || readonlygrid == true || this.disabled)  {
                         return false;
@@ -43,10 +43,11 @@
                     return true;
                 }
             }
-         });
+        });
         this.plugins = [this.rowEditing];
 
         var statusStore = Ext.create('Lada.store.StatusWerte');
+        statusStore.load();
         this.dockedItems = [{
             xtype: 'toolbar',
             dock: 'bottom',
@@ -64,10 +65,11 @@
         }];
         this.columns = [{
             header: 'erstellt',
-            dataIndex: 'sdatum',
+            dataIndex: 'datum',
             xtype: 'datecolumn',
             format: 'd.m.Y H:i',
             width: 110,
+            sortable: false,
         }, {
             header: 'Erzeuger',
             dataIndex: 'erzeuger',
@@ -85,33 +87,36 @@
                 valueField: 'id',
                 allowBlank: false,
                 editable: false
-            }
+            },
+            sortable: false,
         }, {
             header: 'Status',
-            dataIndex: 'status',
+            dataIndex: 'statusWert',
             renderer: function(value) {
                 if (!value || value === '') {
                     return '';
                 }
-                return statusStore.getById(value).get('display');
+                return statusStore.getById(value).get('wert');
             },
             editor: {
                 xtype: 'combobox',
                 store: statusStore,
-                displayField: 'display',
+                displayField: 'wert',
                 valueField: 'id',
                 allowBlank: false,
                 editable: false
-            }
+            },
+            sortable: false,
         }, {
             header: 'Text',
-            dataIndex: 'skommentar',
+            dataIndex: 'text',
             flex: 1,
             editor: {
                 allowBlank: true,
                 maxLength: 1000,
                 enforceMaxLength: true
-            }
+            },
+            sortable: false,
         }];
         this.listeners = {
            select: {
@@ -160,7 +165,7 @@
         }
     },
     /**
-     * Activate the Remove Button
+     * Activate the "Remove Button"
      */
     activateRemoveButton: function(selection, record) {
         var grid = this;
@@ -170,7 +175,7 @@
         }
     },
     /**
-     * Activate the Remove Button
+     * Deactivate the "Remove Button"
      */
     deactivateRemoveButton: function(selection, record) {
         var grid = this;

http://lada.wald.intevation.org