changeset 511:83a98b61546a

Make tables editable for 'Messungen' See LSB 3.5
author Roland Geider <roland.geider@intevation.de>
date Mon, 15 Dec 2014 10:50:32 +0100
parents 1643d74a40bb
children 8818becb8cde
files app/controller/Messungen.js app/view/messungen/List.js gfx/document-open.png
diffstat 3 files changed, 46 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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: {
--- 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',
Binary file gfx/document-open.png has changed

http://lada.wald.intevation.org