Mercurial > lada > lada-client
changeset 860:03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 10 Jul 2015 18:18:00 +0200 (2015-07-10) |
parents | e44070aa45d2 |
children | 99c5dd8e9b0f |
files | app/controller/FilterResult.js app/view/grid/FilterResult.js app/view/window/GenProbenFromMessprogramm.js |
diffstat | 3 files changed, 61 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/FilterResult.js Fri Jul 10 17:14:19 2015 +0200 +++ b/app/controller/FilterResult.js Fri Jul 10 18:18:00 2015 +0200 @@ -34,6 +34,9 @@ 'filterresultgrid toolbar button[action=addMessprogramm]': { click: this.addMessprogrammItem }, + 'filterresultgrid toolbar button[action=genProbenFromMessprogramm]': { + click: this.genProbenFromMessprogramm + }, 'filterresultgrid toolbar button[action=import]': { click: this.uploadFile }, @@ -101,6 +104,46 @@ }, /** + * This button creates a window to generate Proben + * from a selected messprogramm. + */ + genProbenFromMessprogramm: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection(); + var i18n = Lada.getApplication().bundle; + var proben = []; + for (var i = 0; i < selection.length; i++) { + proben.push(selection[i].get('id')); + } + var me = this; + + var winname = 'Lada.view.window.GenProbenFromMessprogramm'; + for (p in proben) { + grid.setLoading(true); + Ext.ClassManager.get('Lada.model.Messprogramm').load(proben[p], { + failure: function(record, action) { + me.setLoading(false); + // TODO + console.log('An unhandled Failure occured. See following Response and Record'); + console.log(action); + console.log(record); + }, + success: function(record, response) { + grid.setLoading(false); + + var win = Ext.create(winname, { + record: record, + parentWindow: null + }); + win.show(); + win.initData(); + }, + scope: this + }); + } + }, + + /** * This function opens a {@link Lada.view.window.FileUpload} * window to upload a LAF-File */
--- a/app/view/grid/FilterResult.js Fri Jul 10 17:14:19 2015 +0200 +++ b/app/view/grid/FilterResult.js Fri Jul 10 18:18:00 2015 +0200 @@ -42,13 +42,6 @@ action: 'addProbe', disabled: false }, { - text: 'Messprogramm erstellen', - icon: 'resources/img/list-add.png', - action: 'addMessprogramm', - disabled: true - }, - '-', - { text: 'Proben Importieren', icon: 'resources/img/svn-commit.png', action: 'import', @@ -58,8 +51,19 @@ icon: 'resources/img/svn-update.png', action: 'export', disabled: true - } - ] + }, + '-', + { + text: 'Messprogramm erstellen', + icon: 'resources/img/list-add.png', + action: 'addMessprogramm', + disabled: true + }, { + text: 'Proben generieren', + icon: 'resources/img/view-time-schedule-insert.png', + action: 'genProbenFromMessprogramm', + disabled: true + }] }]; this.columns = []; this.callParent(arguments); @@ -94,6 +98,7 @@ if (store.model.modelName == 'Lada.model.ProbeList'){ t.setText(i18n.getMsg('probelist')); this.down('button[action=addMessprogramm]').disable(); + this.down('button[action=genProbenFromMessprogramm]').disable(); this.down('button[action=addProbe]').enable(); this.down('button[action=import]').enable(); this.down('button[action=export]').enable(); @@ -101,6 +106,7 @@ else if (store.model.modelName == 'Lada.model.MessprogrammList') { t.setText(i18n.getMsg('probeplanning')); this.down('button[action=addMessprogramm]').enable(); + this.down('button[action=genProbenFromMessprogramm]').enable(); this.down('button[action=addProbe]').disable(); this.down('button[action=import]').disable(); this.down('button[action=export]').disable();
--- a/app/view/window/GenProbenFromMessprogramm.js Fri Jul 10 17:14:19 2015 +0200 +++ b/app/view/window/GenProbenFromMessprogramm.js Fri Jul 10 18:18:00 2015 +0200 @@ -124,7 +124,9 @@ this.getEl().addCls('window-inactive'); }, close: function () { - this.parentWindow.probenWindow = null; + if (this.parentWindow) { + this.parentWindow.probenWindow = null; + } } });