annotate app/controller/PKommentarGrid.js @ 581:424802824648

Added a form for Messungen (unfinished)
author Dustin Demuth <dustin@intevation.de>
date Tue, 10 Mar 2015 17:12:53 +0100
parents 2c8aa09402a2
children
rev   line source
572
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.controller.PKommentarGrid', {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 extend: 'Ext.app.Controller',
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 init: function() {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 this.control({
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 'pkommentargrid': {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 edit: this.edit
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 },
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'pkommentargrid button[action=add]': {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 click: this.add
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 },
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 'pkommentargrid button[action=delete]': {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 click: this.remove
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 }
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 });
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 },
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 edit: function(editor, context) {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 context.record.save({
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 success: function() {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 context.grid.store.reload();
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 context.grid.up('window').initData();
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 },
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 failure: function() {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 // TODO
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 }
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 });
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 },
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 add: function(button) {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 var record = Ext.create('Lada.model.PKommentar');
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 record.set('probeId', button.up('pkommentargrid').recordId);
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 button.up('pkommentargrid').store.insert(0, record);
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 button.up('pkommentargrid').rowEditing.startEdit(0, 1);
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 },
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 remove: function(button) {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 var grid = button.up('grid');
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 var selection = grid.getView().getSelectionModel().getSelection()[0];
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 if (btn === 'yes') {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 selection.destroy({
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 success: function() {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 button.up('window').initData();
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 },
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 failure: function() {
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 // TODO
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 }
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 });
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 }
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 });
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }
2c8aa09402a2 Added controller for PKommentarGrid and implemented update/add/delete.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 });

http://lada.wald.intevation.org