Mercurial > lada > lada-client
view app/controller/grid/MessprogrammeList.js @ 1256:f961f94495c8
Remove erroneous error handling.
This code seems to expect any LADA validation results coming along
with an HTTP status not indicating success, which should not happen.
Instead, Ext.JSON.decode() failed because of the non-JSON responseText
resulting from other errors.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 18 Nov 2016 19:46:15 +0100 |
parents | 56470a075e6e |
children |
line wrap: on
line source
/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz * Software engineering by Intevation GmbH * * This file is Free Software under the GNU GPL (v>=3) * and comes with ABSOLUTELY NO WARRANTY! Check out * the documentation coming with IMIS-Labordaten-Application for details. */ /** * Controller for filter result grid. */ Ext.define('Lada.controller.grid.MessprogrammeList', { extend: 'Ext.app.Controller', requires: [ 'Lada.view.window.Messprogramm', 'Lada.view.window.GenProbenFromMessprogramm' ], /** * Initialize the Controller with listeners */ init: function() { this.control({ 'messprogrammelistgrid': { itemdblclick: this.editItem, select: this.activateButtons, deselect: this.deactivateButtons }, 'messprogrammelistgrid toolbar button[action=addMessprogramm]': { click: this.addMessprogrammItem }, 'messprogrammelistgrid toolbar button[action=genProbenFromMessprogramm]': { click: this.genProbenFromMessprogramm } }); this.callParent(arguments); }, /** * This function is called after a Row in the * {@link Lada.view.grid.MessprogrammeList} * was double-clicked. * The function opens a {@link Lada.view.window.ProbeEdit} * or a {@link Lada.view.window.Messprogramm}. * To determine which window has to be opened, the function * analyse the records modelname. */ editItem: function(grid, record) { var winname = 'Lada.view.window.Messprogramm'; var win = Ext.create(winname, { record: record, style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8 }); win.show(); win.initData(); }, /** * This function opens a new window to create a Probe * {@link Lada.view.window.Messprogramm} */ addMessprogrammItem: function() { var win = Ext.create('Lada.view.window.Messprogramm'); win.show(); win.initData(); }, /** * 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 }); } }, /** * Toggles the buttons in the toolbar **/ activateButtons: function(rowModel, record) { var grid = rowModel.view.up('grid'); this.buttonToggle(true, grid); }, /** * Toggles the buttons in the toolbar **/ deactivateButtons: function(rowModel, record) { var grid = rowModel.view.up('grid'); // Only disable buttons when nothing is selected if (rowModel.selected.items == 0) { this.buttonToggle(false, grid); } }, /** * Enables/Disables a set of buttons **/ buttonToggle: function(enabled, grid) { if (!enabled) { grid.down('button[action=genProbenFromMessprogramm]').disable(); } else { grid.down('button[action=genProbenFromMessprogramm]').enable(); } }, reload: function(btn) { if (btn === 'yes') { location.reload(); } } });