Mercurial > lada > lada-client
view app/controller/grid/Ort.js @ 990:c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 16 Dec 2015 09:49:09 +0100 |
parents | 2362f8ab1e9f |
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. */ /** * This is a controller for a grid of Orte */ Ext.define('Lada.controller.grid.Ort', { extend: 'Ext.app.Controller', requires: [ 'Lada.view.window.OrtEdit', 'Lada.view.window.OrtCreate' ], /** * Inhitialize the controller * It has 3 listeners */ init: function() { this.control({ 'ortgrid': { itemdblclick: this.open }, 'ortgrid button[action=add]': { click: this.add }, 'ortgrid button[action=delete]': { click: this.remove } }); }, /** * When open is called, a {@link Lada.view.window.OrtEdit} * is created which allows to edit the Orte */ open: function(grid, record) { var probe = grid.up('window').record; var win = Ext.create('Lada.view.window.OrtEdit', { parentWindow: grid.up('window'), probe: probe, record: record, grid: grid }); win.show(); win.initData(); }, /** * This function adds a new row to add an Ort */ add: function(button) { var probe = button.up('window').record; var win = Ext.create('Lada.view.window.OrtCreate', { record: probe, grid: button.up('ortgrid') }); win.show(); win.initData(); }, /** * A Ort-row can be removed from the grid with the remove * function. It asks the user for confirmation * If the removal was confirmed, it reloads the parent window on success, * on failure, an error message is shown. */ remove: function(button) { var grid = button.up('grid'); var selection = grid.getView().getSelectionModel().getSelection()[0]; Ext.MessageBox.confirm('Ortsangabe löschen', 'Sind Sie sicher?', function(btn) { if (btn === 'yes') { selection.destroy({ success: function() { button.up('window').initData(); }, failure: function(request, response) { var json = response.request.scope.reader.jsonData; if (json) { if (json.message){ Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title') +' #'+json.message, Lada.getApplication().bundle.getMsg(json.message)); } else { Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), Lada.getApplication().bundle.getMsg('err.msg.generic.body')); } } else { Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), Lada.getApplication().bundle.getMsg('err.msg.response.body')); } } }); } }); grid.down('button[action=delete]').disable(); } });