Mercurial > lada > lada-client
annotate app/view/grid/FilterResult.js @ 867:7b584954b288
Removed tag 2.0.2
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 10 Jul 2015 18:52:35 +0200 |
parents | 03f39ddae596 |
children | b90e29b22ea6 |
rev | line source |
---|---|
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 /* |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 * Grid to list Proben |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.view.grid.FilterResult', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.grid.Panel', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 alias: 'widget.filterresultgrid', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
16 requires: 'Lada.view.window.DeleteProbe', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
17 |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
18 store: null, //'ProbenList', |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 multiSelect: true, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 viewConfig: { |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
23 emptyText: 'Keine Ergebnisse gefunden.', |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 deferEmptyText: false |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 initComponent: function() { |
837
d054732bc7a2
Switch the Mode of the Filterresultgrid according to the selection of the radio buttons in the probenplanungswitcher
Dustin Demuth <dustin@intevation.de>
parents:
806
diff
changeset
|
28 var i18n = Lada.getApplication().bundle; |
d054732bc7a2
Switch the Mode of the Filterresultgrid according to the selection of the radio buttons in the probenplanungswitcher
Dustin Demuth <dustin@intevation.de>
parents:
806
diff
changeset
|
29 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 this.dockedItems = [{ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 xtype: 'toolbar', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 dock: 'top', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 items: [{ |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
34 xtype: 'tbtext', |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
35 id: 'tbtitle', |
837
d054732bc7a2
Switch the Mode of the Filterresultgrid according to the selection of the radio buttons in the probenplanungswitcher
Dustin Demuth <dustin@intevation.de>
parents:
806
diff
changeset
|
36 text: i18n.getMsg('probelist') |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
37 }, |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
38 '->', |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
39 { |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
40 text: 'Probe erstellen', |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 icon: 'resources/img/list-add.png', |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
42 action: 'addProbe', |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
43 disabled: false |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 }, { |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
45 text: 'Proben Importieren', |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 icon: 'resources/img/svn-commit.png', |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
47 action: 'import', |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
48 disabled: false |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 }, { |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
50 text: 'Proben Exportieren', |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 icon: 'resources/img/svn-update.png', |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
52 action: 'export', |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
53 disabled: true |
860
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
54 }, |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
55 '-', |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
56 { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
57 text: 'Messprogramm erstellen', |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
58 icon: 'resources/img/list-add.png', |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
59 action: 'addMessprogramm', |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
60 disabled: true |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
61 }, { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
62 text: 'Proben generieren', |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
63 icon: 'resources/img/view-time-schedule-insert.png', |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
64 action: 'genProbenFromMessprogramm', |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
65 disabled: true |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
66 }] |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 }]; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 this.columns = []; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 this.callParent(arguments); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 /** |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
73 * This sets the Store of the FilterResultGrid |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
74 */ |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
75 setStore: function(store){ |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
76 var i18n = Lada.getApplication().bundle; |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
77 |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
78 this.removeDocked(Ext.getCmp('ptbar'), true); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
79 this.reconfigure(store); |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
80 this.addDocked([{ |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
81 xtype: 'pagingtoolbar', |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
82 id: 'ptbar', |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
83 dock: 'bottom', |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
84 store: store, |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
85 displayInfo: true |
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
86 }]); |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
87 |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
88 //Configure the Toolbar. |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
89 this.setMode(store); |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
90 }, |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
91 |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
92 /** |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
93 * Enables or disables Toolbar-Buttons according to the selected mode |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
94 */ |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
95 setMode: function(store) { |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
96 var t = Ext.getCmp('tbtitle'); |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
97 var i18n = Lada.getApplication().bundle; |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
98 if (store.model.modelName == 'Lada.model.ProbeList'){ |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
99 t.setText(i18n.getMsg('probelist')); |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
100 this.down('button[action=addMessprogramm]').disable(); |
860
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
101 this.down('button[action=genProbenFromMessprogramm]').disable(); |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
102 this.down('button[action=addProbe]').enable(); |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
103 this.down('button[action=import]').enable(); |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
104 this.down('button[action=export]').enable(); |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
105 } |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
106 else if (store.model.modelName == 'Lada.model.MessprogrammList') { |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
107 t.setText(i18n.getMsg('probeplanning')); |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
108 this.down('button[action=addMessprogramm]').enable(); |
860
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
856
diff
changeset
|
109 this.down('button[action=genProbenFromMessprogramm]').enable(); |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
110 this.down('button[action=addProbe]').disable(); |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
111 this.down('button[action=import]').disable(); |
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
112 this.down('button[action=export]').disable(); |
753
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
113 } |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
114 else { |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
115 t.setText(''); |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
116 console.log('The model '+store.model.modelName+ |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
117 'was not defined in the FilterResultGrid.' + |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
118 ' Hence the title could not be set.'); |
4dd0c645ea8b
Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
119 } |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
120 }, |
792
d572ee3271ac
some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
121 |
751
704bb359c0fe
dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents:
682
diff
changeset
|
122 /** |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 * Setup columns of the Grid dynamically based on a list of given cols. |
795
255568e97c96
Latest commit broke the search function
Dustin Demuth <dustin@intevation.de>
parents:
792
diff
changeset
|
124 * The function is called from the {@link Lada.controller.Filter#search |
255568e97c96
Latest commit broke the search function
Dustin Demuth <dustin@intevation.de>
parents:
792
diff
changeset
|
125 * search event} |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 setupColumns: function(cols) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 var resultColumns = []; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 var fields = []; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
131 fields.push(new Ext.data.Field({ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
132 name: 'owner' |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
133 })); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
134 fields.push(new Ext.data.Field({ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
135 name: 'readonly' |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
136 })); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
137 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 resultColumns.push({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 header: 'RW', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 dataIndex: 'readonly', |
682
7b6467edfdfc
RW Column may not be sortable
Dustin Demuth <dustin@intevation.de>
parents:
656
diff
changeset
|
141 sortable: false, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 width: 30, |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
143 renderer: function(value, meta, record) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
144 if ( !value && record.get('owner')) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
145 return '<img src="resources/img/view-time-schedule-edit.png"/>'; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 } |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
147 return '<img src="resources/img/view-time-schedule-baselined.png"/>'; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 }); |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
150 |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 for (var i = cols.length - 1; i >= 0; i--) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 if (cols[i] === 'id') { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 continue; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 resultColumns.push(cols[i]); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 fields.push(new Ext.data.Field({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 name: cols[i].dataIndex |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 })); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 } |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
160 if (this.store.$className == 'Lada.store.ProbenList') { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
161 // Add a Delete-Button |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
162 // TODO: Might need to be extended to Messprogramme |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
163 resultColumns.push({ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
164 xtype: 'actioncolumn', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
165 header: 'Aktionen', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
166 sortable: false, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
167 width: 30, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
168 items: [{ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
169 icon: '/resources/img/edit-delete.png', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
170 tooltip: 'Löschen', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
171 isDisabled: function(grid, rowIndex, colIndex) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
172 var rec = grid.getStore().getAt(rowIndex); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
173 if ( rec.get('readonly') || !rec.get('owner')) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
174 return true; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
175 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
176 return false; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
177 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
178 handler: function(grid, rowIndex, colIndex){ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
179 var rec = grid.getStore().getAt(rowIndex); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
180 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
181 var winname = 'Lada.view.window.DeleteProbe'; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
182 var win = Ext.create(winname, { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
183 record: rec, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
184 parentWindow: this |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
185 }); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
186 win.show(); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
187 win.initData(); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
188 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
189 }] |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
190 }); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
837
diff
changeset
|
191 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 this.store.model.setFields(fields); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 this.reconfigure(this.store, resultColumns); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 }); |