annotate app/view/grid/ProbeList.js @ 1415:3da3772272a5

change column order in ort grid
author Michael Stanko <mstanko@bfs.de>
date Tue, 28 Mar 2017 15:04:25 +0200
parents d391f055022e
children
rev   line source
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
8
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
9 /**
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
10 * Grid to list the result of the Filter
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
11 */
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.grid.ProbeList', {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Lada.view.widget.DynamicGrid',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14 alias: 'widget.probelistgrid',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
15
1189
ec2b10d81343 Add missing requirements.
Tom Gottfried <tom@intevation.de>
parents: 1161
diff changeset
16 requires: [
ec2b10d81343 Add missing requirements.
Tom Gottfried <tom@intevation.de>
parents: 1161
diff changeset
17 'Lada.view.window.DeleteProbe',
ec2b10d81343 Add missing requirements.
Tom Gottfried <tom@intevation.de>
parents: 1161
diff changeset
18 'Lada.view.window.ProbeCreate'
ec2b10d81343 Add missing requirements.
Tom Gottfried <tom@intevation.de>
parents: 1161
diff changeset
19 ],
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
20
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
21 initComponent: function() {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
22 var i18n = Lada.getApplication().bundle;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
23 this.emptyText = i18n.getMsg('probe.emptyGrid');
1161
f56f3970d755 Checkbox added to ProbeList and MessprogrammList
Evi Huber <ehuber@bfs.de>
parents: 1021
diff changeset
24 this.selModel = Ext.create('Ext.selection.CheckboxModel', {
f56f3970d755 Checkbox added to ProbeList and MessprogrammList
Evi Huber <ehuber@bfs.de>
parents: 1021
diff changeset
25 checkOnly: true,
f56f3970d755 Checkbox added to ProbeList and MessprogrammList
Evi Huber <ehuber@bfs.de>
parents: 1021
diff changeset
26 injectCheckbox: 1
f56f3970d755 Checkbox added to ProbeList and MessprogrammList
Evi Huber <ehuber@bfs.de>
parents: 1021
diff changeset
27 });
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
28 this.dockedItems = [{
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
29 xtype: 'toolbar',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
30 dock: 'top',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
31 items: [{
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
32 xtype: 'tbtext',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 text: i18n.getMsg('probe.gridTitle')
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34 },
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35 '->',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
36 {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
37 text: i18n.getMsg('probe.button.create'),
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
38 icon: 'resources/img/list-add.png',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
39 action: 'addProbe',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
40 disabled: false
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 }, {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 text: i18n.getMsg('probe.button.import'),
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 icon: 'resources/img/svn-commit.png',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
44 action: 'import',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 disabled: false
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
46 }, {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 text: i18n.getMsg('probe.button.export'),
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 icon: 'resources/img/svn-update.png',
977
56470a075e6e Added methods to the controllers to disable/enable buttons in the toolbar when rows are (de)selected
Dustin Demuth <dustin@intevation.de>
parents: 975
diff changeset
49 action: 'export',
56470a075e6e Added methods to the controllers to disable/enable buttons in the toolbar when rows are (de)selected
Dustin Demuth <dustin@intevation.de>
parents: 975
diff changeset
50 disabled: true //disabled on start, enabled by the controller
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 }, {
1244
d391f055022e WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents: 1189
diff changeset
52 text: i18n.getMsg('probe.button.printSheet'),
d391f055022e WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents: 1189
diff changeset
53 icon: 'resources/img/printer.png',
d391f055022e WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents: 1189
diff changeset
54 action: 'printSheet',
d391f055022e WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents: 1189
diff changeset
55 disabled: true //disabled on start, enabled by the controller
d391f055022e WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents: 1189
diff changeset
56 }, {
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 text: i18n.getMsg('probe.button.print'),
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
58 icon: 'resources/img/printer.png',
1244
d391f055022e WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents: 1189
diff changeset
59 action: 'printExtract',
977
56470a075e6e Added methods to the controllers to disable/enable buttons in the toolbar when rows are (de)selected
Dustin Demuth <dustin@intevation.de>
parents: 975
diff changeset
60 disabled: true //disabled on start, enabled by the controller
975
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
61 }]
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 }];
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
63 this.columns = [];
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64 this.callParent(arguments);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 },
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
67 /**
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68 * Setup columns of the Grid dynamically based on a list of given cols.
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 * The function is called from the {@link Lada.controller.Filter#search
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 * search event}
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
71 * The Images for the Read-Write Icon are defined in CSS
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 * This Method overrides setupColumns of the parents class,
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
73 * becaus the delete colum is required.
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 */
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 setupColumns: function(cols) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
76 var caf = this.generateColumnsAndFields(cols);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
77 var columns = caf[0];
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
78 var fields = caf[1];
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
79 var i18n = Lada.getApplication().bundle;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
80
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
81 columns.push({
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
82 xtype: 'actioncolumn',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
83 text: i18n.getMsg('action'),
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
84 sortable: false,
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
85 width: 30,
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
86 items: [{
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
87 icon: 'resources/img/edit-delete.png',
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
88 tooltip: i18n.getMsg('delete'),
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
89 isDisabled: function(grid, rowIndex, colIndex) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
90 var rec = grid.getStore().getAt(rowIndex);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
91 if ( rec.get('readonly') || !rec.get('owner')) {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
92 return true;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
93 }
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
94 return false;
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
95 },
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
96 handler: function(grid, rowIndex, colIndex){
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
97 var rec = grid.getStore().getAt(rowIndex);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
98
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
99 var winname = 'Lada.view.window.DeleteProbe';
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
100 var win = Ext.create(winname, {
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
101 record: rec,
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
102 parentWindow: this
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
103 });
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
104 win.show();
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
105 win.initData();
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
106 }
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
107 }]
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
108 });
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
109 this.store.model.setFields(fields);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
110 this.reconfigure(this.store, columns);
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
111 }
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
112 });
fb99332bb48e Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
113

http://lada.wald.intevation.org