diff app/controller/Proben.js @ 381:9bc080ecdbc9

Added action in controller to download the file in a new window.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 27 Aug 2013 10:40:14 +0200
parents 0fa48c66cf7d
children 91193c49c2bb
line wrap: on
line diff
--- a/app/controller/Proben.js	Tue Aug 27 10:14:30 2013 +0200
+++ b/app/controller/Proben.js	Tue Aug 27 10:40:14 2013 +0200
@@ -68,6 +68,9 @@
             'probenlist toolbar button[action=import]': {
                 click: this.selectUploadFile
             },
+            'probenlist toolbar button[action=export]': {
+                click: this.downloadFile
+            },
             'probencreate button[action=save]': {
                 click: this.saveItem
             },
@@ -128,6 +131,15 @@
             });
         }
     },
+    /**
+     * Will download the selected Probe in LAF format in a new window (tab).
+     */
+    downloadFile: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        var url = "server/rest/export/laf/" + selection.get('probeId');
+        window.open(url, "_blank");
+    },
     editItem: function(grid, record) {
         console.log('Editing Probe');
         var id = record.get('probeId');

http://lada.wald.intevation.org