Mercurial > lada > lada-client
diff app/controller/FilterResult.js @ 725:83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 16 Apr 2015 15:55:32 +0200 |
parents | e0b966b32163 |
children | e002234d7da5 |
line wrap: on
line diff
--- a/app/controller/FilterResult.js Thu Apr 16 15:53:53 2015 +0200 +++ b/app/controller/FilterResult.js Thu Apr 16 15:55:32 2015 +0200 @@ -41,18 +41,42 @@ win.initData(); }, - addItem: function(button) { + addItem: function() { var win = Ext.create('Lada.view.window.ProbeCreate'); win.show(); win.initData(); - }, - uploadFile: function(button) { + uploadFile: function() { + var win = Ext.create('Lada.view.window.FileUpload', { + title: 'Datenimport', + modal: true + }); + win.show(); }, downloadFile: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection(); + var proben = []; + for (var i = 0; i < selection.length; i++) { + proben.push(selection[i].get('id')); + } + Ext.Ajax.request({ + method: 'POST', + url: '/lada-server/export/laf', + jsonData: {'proben': proben}, + headers: {'X-OPENID-PARAMS': Lada.openIDParams}, + success: function(response) { + var content = response.responseText; + var blob = new Blob([content],{type: 'text/plain'}); + saveAs(blob, 'export.laf'); + }, + failure: function() { + Ext.Msg.alert('Fehler', 'Failed to create LAF-File!'); + } + }); } });