Mercurial > lada > lada-client
annotate app/view/orte/List.js @ 546:43951e42590c
Added tag mockup-1.1 for changeset 7c9475119861
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 18 Dec 2014 16:52:45 +0100 |
parents | 7c9475119861 |
children |
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. |
530
95bad130be98
Increased list grid height.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
522
diff
changeset
|
21 minHeight: 65, |
94
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: ['->', { |
522
de1acaf21db3
Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents:
513
diff
changeset
|
41 text: 'Details', |
de1acaf21db3
Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents:
513
diff
changeset
|
42 icon: 'gfx/document-open.png', |
545
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
43 action: 'open', |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
44 disabled: true |
522
de1acaf21db3
Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents:
513
diff
changeset
|
45 }, { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
46 text: 'Hinzufügen', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
47 icon: 'gfx/list-add.png', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
48 action: 'add', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
49 probeId: this.probeId |
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 text: 'Löschen', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
52 icon: 'gfx/list-remove.png', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
53 action: 'delete' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
54 }] |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
55 }]; |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
56 this.columns = [{ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
57 header: 'Typ', |
510
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
58 dataIndex: 'ortsTyp', |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
59 editor: { |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
60 allowBlank: false |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
61 } |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
62 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
63 header: 'Staat', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
64 dataIndex: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
65 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
|
66 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
|
67 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
|
68 var record = |
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
69 staaten.getById(store.getById(value).get('staatId')); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
70 return record.get('staatIso'); |
94
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
71 } |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
72 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
73 header: 'Gemeineschlüssel', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
74 dataIndex: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
75 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
|
76 var store = Ext.data.StoreManager.get('staOrte'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
77 var record = store.getById(value); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
78 return record.get('gemId'); |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
105
diff
changeset
|
79 } |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
80 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
81 header: 'Gemeindename', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
82 dataIndex: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
83 flex: 1, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
84 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
|
85 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
|
86 var gemeinden = |
d07e5086a64b
Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
491
diff
changeset
|
87 Ext.data.StoreManager.get('staVerwaltungseinheiten'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
88 var record = store.getById(value); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
89 var gemid = record.get('gemId'); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
90 var record2 = gemeinden.getById(gemid); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
91 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
|
92 } |
510
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
93 //editor: { |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
94 // allowBlank: false |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
95 //} |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
96 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
97 header: 'Messpunkt', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
98 dataIndex: 'ortId', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
99 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
|
100 var store = Ext.getStore('staOrte'); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
101 var record = store.getById(value); |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
102 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
|
103 } |
510
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
104 //editor: { |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
105 // allowBlank: false |
1643d74a40bb
Make tables editable for 'Orte'
Roland Geider <roland.geider@intevation.de>
parents:
499
diff
changeset
|
106 //} |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
107 }]; |
94
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
108 this.callParent(arguments); |
545
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
109 }, |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
110 listeners: { |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
111 selectionchange: function(model, selected, eOpts) { |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
112 /* |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
113 * Enable the 'details' button only when an item is selected |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
114 */ |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
115 if (selected.length > 0) { |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
116 this.down('button[action=open]').enable(); |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
117 } |
7c9475119861
Enable the 'details' button only when an item is selected
Roland Geider <roland.geider@intevation.de>
parents:
530
diff
changeset
|
118 } |
94
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
119 } |
21c069e2ecdb
Added Orte to the Proben edit window
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
120 }); |