annotate app/view/grid/FilterResult.js @ 899:69a22279cdb6

Proudly changed version to 2.1.0
author Dustin Demuth <dustin@intevation.de>
date Thu, 06 Aug 2015 10:02:59 +0200
parents 07dfcdf5b41f
children 7cbbe0485d0d
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
893
07dfcdf5b41f jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents: 878
diff changeset
9 /**
07dfcdf5b41f jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents: 878
diff changeset
10 * Grid to list the result of the Filter
548
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}
878
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
126 * The Images for the Read-Write Icon are defined in CSS
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 setupColumns: function(cols) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 var resultColumns = [];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 var fields = [];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131
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
132 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
133 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
134 }));
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 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
136 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
137 }));
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
138
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 resultColumns.push({
878
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
140 xtype: 'actioncolumn',
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
141 text: 'RW',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 dataIndex: 'readonly',
682
7b6467edfdfc RW Column may not be sortable
Dustin Demuth <dustin@intevation.de>
parents: 656
diff changeset
143 sortable: false,
878
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
144 tooltip: 'Probe öffnen',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 width: 30,
878
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
146 getClass: function (val, meta, rec) {
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
147 return rec.get('readonly') === false ? "edit" : "noedit";
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
148 },
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
149 handler: function(grid, rowIndex, colIndex) {
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
150 var rec = grid.getStore().getAt(rowIndex);
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
151 grid.fireEvent('itemdblclick', grid, rec);
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
152 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 });
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
154
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 for (var i = cols.length - 1; i >= 0; i--) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 if (cols[i] === 'id') {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 continue;
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 resultColumns.push(cols[i]);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 fields.push(new Ext.data.Field({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 name: cols[i].dataIndex
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 }));
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 }
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
164 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
165 // 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
166 // 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
167 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
168 xtype: 'actioncolumn',
878
545b8913601d Applied patch from Workshop: The RW-Icon in the Probenliste is now clickable. This somehow affected the List of Proben which is now more dense.
Dustin Demuth <dustin@intevation.de>
parents: 868
diff changeset
169 text: 'Aktion',
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
170 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
171 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
172 items: [{
868
b90e29b22ea6 Fixed path to image.
Raimund Renkert <rrenkert@intevation.de>
parents: 860
diff changeset
173 icon: 'resources/img/edit-delete.png',
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
174 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
175 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
176 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
177 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
178 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
179 }
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 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
181 },
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 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
183 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
184
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 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
186 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
187 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
188 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
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 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
191 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
192 }
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
193 }]
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
194 });
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
195 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 this.store.model.setFields(fields);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 this.reconfigure(this.store, resultColumns);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 });

http://lada.wald.intevation.org