Mercurial > lada > lada-client
annotate app/view/orte/List.js @ 518:97a428548a24
Added save and discard button to messung edit head and listen for change event to enable/disable buttons.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 16 Dec 2014 16:56:23 +0100 |
parents | 6de00657cd87 |
children | de1acaf21db3 |
rev | line source |
---|---|
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
459
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
459
diff
changeset
|
2 * Software engineering by Intevation GmbH |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
459
diff
changeset
|
3 * |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
459
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
459
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
459
diff
changeset
|
7 */ |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
459
diff
changeset
|
8 |
347
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
152
diff
changeset
|
9 /* |
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
152
diff
changeset
|
10 * Grid to list Orte |
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
152
diff
changeset
|
11 */ |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
496
diff
changeset
|
12 Ext.define('Lada.view.orte.List', { |
94
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.grid.Panel', |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 alias: 'widget.ortelist', |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
15 |
94
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 viewConfig: { |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 maxHeight: 350, |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 emptyText: 'Keine Orte gefunden.', |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 // minHeight and deferEmptyText are needed to be able to show the |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 // emptyText message. |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 minHeight: 35, |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 deferEmptyText: false |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
23 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
24 |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
105
diff
changeset
|
25 probeId: null, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
26 |
94
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
27 initComponent: function() { |
510
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
28 var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
29 clicksToMoveEditor: 1, |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
30 autoCancel: false |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
31 }); |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
32 this.plugins = [rowEditing]; |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
33 this.store = Ext.data.StoreManager.get('Orte'); |
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
34 if (!this.store) { |
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
35 this.store = Ext.create('Lada.store.Orte'); |
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
36 } |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
37 this.dockedItems = [{ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
38 xtype: 'toolbar', |
513
6de00657cd87
Moved alll list toolbars to bottom and buttons to the right.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
510
diff
changeset
|
39 dock: 'bottom', |
6de00657cd87
Moved alll list toolbars to bottom and buttons to the right.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
510
diff
changeset
|
40 items: ['->', { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
41 text: 'Hinzufügen', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
42 icon: 'gfx/list-add.png', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
43 action: 'add', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
44 probeId: this.probeId |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
45 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
46 text: 'Löschen', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
47 icon: 'gfx/list-remove.png', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
48 action: 'delete' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
49 }] |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
50 }]; |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
51 this.columns = [{ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
52 header: 'Typ', |
510
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
53 dataIndex: 'ortsTyp', |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
54 editor: { |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
55 allowBlank: false |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
56 } |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
57 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
58 header: 'Staat', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
59 dataIndex: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
60 renderer: function(value) { |
496
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
61 var store = Ext.data.StoreManager.get('staOrte'); |
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
62 var staaten = Ext.data.StoreManager.get('staStaaten'); |
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
63 var record = |
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
64 staaten.getById(store.getById(value).get('staatId')); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
65 return record.get('staatIso'); |
94
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
66 } |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
67 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
68 header: 'Gemeineschlüssel', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
69 dataIndex: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
70 renderer: function(value) { |
496
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
71 var store = Ext.data.StoreManager.get('staOrte'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
72 var record = store.getById(value); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
73 return record.get('gemId'); |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
105
diff
changeset
|
74 } |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
75 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
76 header: 'Gemeindename', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
77 dataIndex: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
78 flex: 1, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
79 renderer: function(value) { |
496
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
80 var store = Ext.data.StoreManager.get('staOrte'); |
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
81 var gemeinden = |
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
82 Ext.data.StoreManager.get('staVerwaltungseinheiten'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
83 var record = store.getById(value); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
84 var gemid = record.get('gemId'); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
85 var record2 = gemeinden.getById(gemid); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
86 return record2.get('bezeichnung'); |
513
6de00657cd87
Moved alll list toolbars to bottom and buttons to the right.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
510
diff
changeset
|
87 } |
510
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
88 //editor: { |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
89 // allowBlank: false |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
90 //} |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
91 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
92 header: 'Messpunkt', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
93 dataIndex: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
94 renderer: function(value) { |
496
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
95 var store = Ext.getStore('staOrte'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
96 var record = store.getById(value); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
97 return record.get('bezeichnung'); |
513
6de00657cd87
Moved alll list toolbars to bottom and buttons to the right.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
510
diff
changeset
|
98 } |
510
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
99 //editor: { |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
100 // allowBlank: false |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
101 //} |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
102 }]; |
94
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
103 this.callParent(arguments); |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
104 } |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
105 }); |