[Lada-commits] [PATCH 2 of 2] Make tables editable for 'Messungen'

Wald Commits scm-commit at wald.intevation.org
Mon Dec 15 10:52:01 CET 2014


# HG changeset patch
# User Roland Geider <roland.geider at intevation.de>
# Date 1418637032 -3600
# Node ID 83a98b61546a7ec74b4ef97264b1ce21e4fd721a
# Parent  1643d74a40bbce38fdc70aaaff04479696575c59
Make tables editable for 'Messungen'

See LSB 3.5

diff -r 1643d74a40bb -r 83a98b61546a app/controller/Messungen.js
--- a/app/controller/Messungen.js	Mon Dec 15 10:49:40 2014 +0100
+++ b/app/controller/Messungen.js	Mon Dec 15 10:50:32 2014 +0100
@@ -31,8 +31,8 @@
 
     addListeners: function() {
         this.control({
-            'messungenlist': {
-                itemdblclick: this.editItem
+            'messungenlist toolbar button[action=open]': {
+                click: this.editItem
             },
             'messungenlist toolbar button[action=add]': {
                 click: this.addItem
@@ -70,7 +70,12 @@
         });
     },
 
-    editItem: function(grid, record) {
+    editItem: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        var messungsId = selection.getId();
+        var record = selection.store.getById(messungsId);
+
         var kstore = this.getKommentareMStore();
         kstore.load({
             params: {
diff -r 1643d74a40bb -r 83a98b61546a app/view/messungen/List.js
--- a/app/view/messungen/List.js	Mon Dec 15 10:49:40 2014 +0100
+++ b/app/view/messungen/List.js	Mon Dec 15 10:50:32 2014 +0100
@@ -24,8 +24,17 @@
     },
 
     probeId: null,
+    
+    
 
     initComponent: function() {
+        var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
+            clicksToMoveEditor: 1,
+            autoCancel: false
+        });
+        
+        this.plugins = [rowEditing];
+        
         this.dockedItems = [{
             xtype: 'toolbar',
             dock: 'top',
@@ -38,22 +47,43 @@
                 text: 'Löschen',
                 icon: 'gfx/list-remove.png',
                 action: 'delete'
+            }, {
+                text: 'Öffnen',
+                icon: 'gfx/document-open.png',
+                action: 'open'
             }]
         }];
         this.columns = [{
             header: 'Mess.ID',
+            editor: {
+                allowBlank: false
+            },
             dataIndex: 'id',
             width: 50
         }, {
             header: 'NPR-Nr.',
+            editor: {
+                allowBlank: false
+            },
             dataIndex: 'nebenprobenNr',
             width: 50
         }, {
             header: 'MMT',
+            editor: {
+                allowBlank: false
+            },
             dataIndex: 'mmtId',
             width: 50
         }, {
             header: 'Messzeit',
+            editor: {
+                xtype: 'datefield',
+                allowBlank: false,
+                format: 'd.m.Y',
+                minValue: '01.01.2001', // TODO: gibt es ein minValue?
+                //minText: 'Fehlertext', // TODO: Fehlertext falls minValue
+                maxValue: Ext.Date.format(new Date(), 'd.m.Y')
+            },
             dataIndex: 'messzeitpunkt'
         }, {
             header: 'Status',
@@ -71,6 +101,10 @@
                     return 'unbekannt';
                 }
                 return sstore.last().get('status');
+            },
+            editor: {
+                xtype: 'numberfield',
+                allowBlank: false,
             }
         }, {
             header: 'OK-Flag',
@@ -81,6 +115,10 @@
                     return 'Ja';
                 }
                 return 'Nein';
+            },
+            editor: {
+                xtype: 'checkboxfield',
+                allowBlank: false,
             }
          }, {
             header: 'Anzahl Nuklide',
diff -r 1643d74a40bb -r 83a98b61546a gfx/document-open.png
Binary file gfx/document-open.png has changed


More information about the Lada-commits mailing list