annotate app/view/grid/FilterResult.js @ 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
author Dustin Demuth <dustin@intevation.de>
date Fri, 10 Jul 2015 17:14:19 +0200
parents d054732bc7a2
children 03f39ddae596
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: 'Messprogramm erstellen',
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
46 icon: 'resources/img/list-add.png',
792
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
47 action: 'addMessprogramm',
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
48 disabled: true
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
49 },
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
50 '-',
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
51 {
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
52 text: 'Proben Importieren',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 icon: 'resources/img/svn-commit.png',
792
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
54 action: 'import',
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
55 disabled: false
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 }, {
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
57 text: 'Proben Exportieren',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 icon: 'resources/img/svn-update.png',
792
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
59 action: 'export',
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
60 disabled: true
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
61 }
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
62 ]
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 this.columns = [];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 },
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 /**
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
69 * This sets the Store of the FilterResultGrid
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
70 */
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
71 setStore: function(store){
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
72 var i18n = Lada.getApplication().bundle;
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
73
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
74 this.removeDocked(Ext.getCmp('ptbar'), true);
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
75 this.reconfigure(store);
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
76 this.addDocked([{
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
77 xtype: 'pagingtoolbar',
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
78 id: 'ptbar',
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
79 dock: 'bottom',
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
80 store: store,
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
81 displayInfo: true
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
82 }]);
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
83
792
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
84 //Configure the Toolbar.
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
85 this.setMode(store);
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
86 },
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
87
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
88 /**
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
89 * 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
90 */
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
91 setMode: function(store) {
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
92 var t = Ext.getCmp('tbtitle');
792
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
93 var i18n = Lada.getApplication().bundle;
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
94 if (store.model.modelName == 'Lada.model.ProbeList'){
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
95 t.setText(i18n.getMsg('probelist'));
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
96 this.down('button[action=addMessprogramm]').disable();
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
97 this.down('button[action=addProbe]').enable();
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
98 this.down('button[action=import]').enable();
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
99 this.down('button[action=export]').enable();
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
100 }
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
101 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
102 t.setText(i18n.getMsg('probeplanning'));
792
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
103 this.down('button[action=addMessprogramm]').enable();
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
104 this.down('button[action=addProbe]').disable();
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
105 this.down('button[action=import]').disable();
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
106 this.down('button[action=export]').disable();
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
107 }
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
108 else {
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
109 t.setText('');
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
110 console.log('The model '+store.model.modelName+
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
111 'was not defined in the FilterResultGrid.' +
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
112 ' Hence the title could not be set.');
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
113 }
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
114 },
792
d572ee3271ac some work on a context-sensitive toolbar
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
115
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
116 /**
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 * 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
118 * 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
119 * search event}
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 setupColumns: function(cols) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 var resultColumns = [];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 var fields = [];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124
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
125 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
126 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
127 }));
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
128 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
129 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
130 }));
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
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 resultColumns.push({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 header: 'RW',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 dataIndex: 'readonly',
682
7b6467edfdfc RW Column may not be sortable
Dustin Demuth <dustin@intevation.de>
parents: 656
diff changeset
135 sortable: false,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 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
137 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
138 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
139 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
140 }
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
141 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
142 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 });
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
144
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 for (var i = cols.length - 1; i >= 0; i--) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 if (cols[i] === 'id') {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 continue;
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 resultColumns.push(cols[i]);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 fields.push(new Ext.data.Field({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 name: cols[i].dataIndex
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 }));
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 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
155 // 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
156 // 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
157 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
158 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
159 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
160 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
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168 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
169 }
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 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
171 },
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 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
173 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
174
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 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
176 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
177 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
178 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
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 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
181 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
182 }
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 }]
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 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 this.store.model.setFields(fields);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 this.reconfigure(this.store, resultColumns);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 });

http://lada.wald.intevation.org