annotate app/controller/grid/MessungList.js @ 1429:8e5326142711

Removed extra params from messgroesse store to show all entries in messwert grid.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 07 Apr 2017 09:57:26 +0200
parents 69ebd572fe5c
children
rev   line source
1076
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Controller for the MessungList result grid.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.controller.grid.MessungList', {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.app.Controller',
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 requires: [
1157
056ffbc2790a Add more missing requirements.
Tom Gottfried <tom@intevation.de>
parents: 1120
diff changeset
15 'Lada.view.window.SetStatus',
1076
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 'Lada.view.window.ProbeEdit'
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 ],
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 /**
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 * Initialize the Controller with listeners
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 */
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 init: function() {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 this.control({
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 'messunglistgrid': {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 itemdblclick: this.editItem,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 select: this.activateButtons,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 deselect: this.deactivateButtons
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
28 },
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
29 'messunglistgrid toolbar button[action=setstatus]': {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
30 click: this.setStatus
1400
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
31 },
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
32 'messunglistgrid pagingtoolbar': {
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
33 change: this.pageChange
1076
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 });
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 this.callParent(arguments);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 },
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 /**
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
40 * Sets the Status on Bulk
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
41 **/
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
42 setStatus: function(button) {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
43 //disable Button and setLoading...
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
44
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
45 var grid = button.up('grid');
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
46 var selection = grid.getView().getSelectionModel().getSelection();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
47 var i18n = Lada.getApplication().bundle;
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
48
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
49 var win = Ext.create('Lada.view.window.SetStatus', {
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
50 title: i18n.getMsg('statusSetzen.win.title'),
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
51 grid: grid,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
52 modal: true,
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
53 selection: selection
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
54 });
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
55
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
56 win.show();
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
57
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
58 },
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
59
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
60
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
61 /**
1076
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 * This function is called after a Row in the
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 * {@link Lada.view.grid.ProbeList}
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 * was double-clicked.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 * The function opens a {@link Lada.view.window.ProbeEdit}
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 * or a {@link Lada.view.window.Messprogramm}.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 * To determine which window has to be opened, the function
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 * analyse the records modelname.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 */
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 editItem: function(grid, record) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 var probeRecord = Ext.create('Lada.model.ProbeList');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 probeRecord.setId(record.get('probeId'));
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 probeRecord.set('owner', record.get('owner'));
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 probeRecord.set('readonly', record.get('readonly'));
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 var probeWin = Ext.create('Lada.view.window.ProbeEdit', {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 record: probeRecord,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 });
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 probeWin.setPosition(30);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 probeWin.show();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 probeWin.initData();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 Ext.ClassManager.get('Lada.model.Probe').load(record.get('probeId'), {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 failure: function(record, action) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 me.setLoading(false);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 // TODO
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 console.log('An unhandled Failure occured. See following Response and Record');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 console.log(action);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 console.log(record);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 },
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 success: function(precord, response) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 var messungWin = Ext.create('Lada.view.window.MessungEdit', {
1120
0a032c98c3a6 Use correct parent window reference for messung windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1082
diff changeset
95 parentWindow: probeWin,
1076
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 probe: precord,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 record: record,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 grid: grid
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 });
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 messungWin.show();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 messungWin.setPosition(window.innerWidth - 30 - messungWin.width);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 messungWin.initData();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 });
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 },
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 /**
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 * Send the selection to a Printservice
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 */
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 printSelection: function(button) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 //disable Button and setLoading...
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 button.disable();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 button.setLoading(true);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 var grid = button.up('grid');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 var selection = grid.getView().getSelectionModel().getSelection();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 var i18n = Lada.getApplication().bundle;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 var me = this;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 var columns = [];
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 var columnNames = [];
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 var visibleColumns = [];
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 var displayName = '';
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 var data = [];
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 // Write the columns to an array
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 try {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 for (key in selection[0].data) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 // Do not write owner or readonly or id
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 if (["owner", "readonly", "id", "probeId"].indexOf(key) == -1){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 columns.push(key);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 catch (e) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 console.log(e);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 //Retrieve visible columns' id's and names.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 // and set displayName
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 try {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 var grid = button.up('grid');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 var cman = grid.columnManager;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 var cols = cman.getColumns();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 displayName = grid.down('tbtext').text;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 for (key in cols) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 if (cols[key].dataIndex) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 visibleColumns[cols[key].dataIndex] = cols[key].text;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 catch (e) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 console.log(e);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 // Retrieve Data from selection
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 try {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 for (item in selection) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 var row = selection[item].data;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 var out = [];
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 //Lookup every column and write to data array.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 for (key in columns){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 var attr = columns[key];
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 //Only write data to output when the column is not hidden.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 if (row[attr] != null &&
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 visibleColumns[attr] != null) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 out.push(row[attr].toString());
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 else if (visibleColumns[attr] != null) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 out.push('');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 data.push(out);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 catch (e){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 console.log(e);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 //Retrieve the names of the columns.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 try {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 var grid = button.up('grid');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 var cman = grid.columnManager;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 var cols = cman.getColumns();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 //Iterate columns and find column names for the key...
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 // This WILL run into bad behaviour when column-keys exist twice.
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 for (key in columns){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 for (k in cols){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 if (cols[k].dataIndex == columns[key]){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 columnNames.push(cols[k].text);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 break;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 catch (e) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 console.log(e);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 var printData = {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 'layout': 'A4 landscape',
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 'outputFormat': 'pdf',
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 'attributes': {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 'title': 'Auszug aus LADA',
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 'displayName': displayName,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 'table': {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210 'columns': columnNames,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 'data': data
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 Ext.Ajax.request({
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 url: 'lada-printer/buildreport.pdf',
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 //configure a proxy in apache conf!
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219 jsonData: printData,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220 binary: true,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
221 success: function(response) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
222 var content = response.responseBytes;
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
223 var filetype = response.getResponseHeader('Content-Type');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
224 var blob = new Blob([content],{type: filetype});
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
225 saveAs(blob, 'lada-print.pdf');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
226 button.enable();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
227 button.setLoading(false);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
228 },
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
229 failure: function(response) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
230 console.log('failure');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
231 // Error handling
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
232 // TODO
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
233 //console.log(response.responseText)
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
234 button.enable();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
235 button.setLoading(false);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
236 if (response.responseText) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
237 try {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
238 var json = Ext.JSON.decode(response.responseText);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
239 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
240 catch(e){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
241 console.log(e);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
242 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
243 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
244 if (json) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
245 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
246 formPanel.setMessages(json.errors, json.warnings);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
247 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
248 if(json.message){
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
249 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title')
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
250 +' #'+json.message,
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
251 Lada.getApplication().bundle.getMsg(json.message));
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
252 } else {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
253 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
254 i18n.getMsg('err.msg.print.noContact'));
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
255 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
256 } else {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
257 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
258 i18n.getMsg('err.msg.print.noContact'));
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
259 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
260 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
261 });
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
262 },
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
263
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
264 /**
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
265 * Toggles the buttons in the toolbar
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
266 **/
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
267 activateButtons: function(rowModel, record) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
268 var grid = rowModel.view.up('grid');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
269 this.buttonToggle(true, grid);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
270 },
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
271
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
272 /**
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
273 * Toggles the buttons in the toolbar
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
274 **/
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
275 deactivateButtons: function(rowModel, record) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
276 var grid = rowModel.view.up('grid');
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
277 // Only disable buttons when nothing is selected
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
278 if (rowModel.selected.items == 0) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
279 this.buttonToggle(false, grid);
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
280 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
281 },
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
282
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
283 /**
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
284 * Enables/Disables a set of buttons
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
285 **/
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
286 buttonToggle: function(enabled, grid) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
287 if (!enabled) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
288 grid.down('button[action=print]').disable();
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
289 grid.down('button[action=setstatus]').disable();
1076
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
290 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
291 else {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
292 grid.down('button[action=print]').enable();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
293 // TODO: enable button only on messungen with owner == true and
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
294 // readonly == false
1082
dbd435256f77 Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1076
diff changeset
295 grid.down('button[action=setstatus]').enable();
1076
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
296 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
297 },
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
298
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
299 reload: function(btn) {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
300 if (btn === 'yes') {
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
301 location.reload();
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
302 }
1400
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
303 },
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
304
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
305 pageChange: function(toolbar) {
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
306 var grid = toolbar.up('grid');
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
307 var store = grid.getStore();
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
308 var rowExpander = grid.plugins[0]
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
309 var nodes = rowExpander.view.getNodes();
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
310 for (var i = 0; i < nodes.length; i++) {
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
311 var node = Ext.fly(nodes[i]);
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
312 if (node.hasCls(rowExpander.rowCollapsedCls) === false) {
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
313 rowExpander.toggleRow(i, store.getAt(i));
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
314 }
69ebd572fe5c Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1157
diff changeset
315 }
1076
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
316 }
e32c10cf5499 Added model/store, view and controller for messung list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
317 });

http://lada.wald.intevation.org