Mercurial > lada > lada-client
annotate app/view/proben/List.js @ 364:d0f5be50aed5
Fixed syntax
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Thu, 15 Aug 2013 16:58:48 +0200 |
parents | 3bed0373cf50 |
children | 832e3c8f9191 |
rev | line source |
---|---|
348
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
1 /* |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
2 * Grid to list Proben |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
3 */ |
4
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 Ext.define('Lada.view.proben.List' ,{ |
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 extend: 'Ext.grid.Panel', |
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 alias: 'widget.probenlist', |
13
a8efc4b96888
Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
4
diff
changeset
|
7 store: 'Proben', |
37
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
8 viewConfig: { |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
9 maxHeight: 350, |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
10 emptyText: 'Keine Proben gefunden.', |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
11 // minHeight and deferEmptyText are needed to be able to show the |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
12 // emptyText message. |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
13 minHeight: 35, |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
14 deferEmptyText: false |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
15 }, |
237
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
16 availableColumns: [ |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
17 {header: 'Datenbasis', dataIndex: 'datenbasisId', width: 70}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
18 {header: 'MPL', dataIndex: 'mplId', width: 50}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
19 {header: 'UWB', dataIndex: 'umwId', width: 50}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
20 {header: 'MMT', dataIndex: 'messmethode'}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
21 {header: 'HPNR', dataIndex: 'hauptprobenNr'}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
22 {header: 'NPNR', dataIndex: 'nebenprobenNr'}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
23 {header: 'E.Gemeinde', dataIndex: 'bezeichnung', flex: 1}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
24 {header: 'Ursprungsgemeinde', dataIndex: 'kreis', flex: 1}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
25 {header: 'ProbeID', dataIndex: 'probeId'}, |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
26 {header: 'MST', dataIndex: 'mstId', width: 50} |
bc2d46a67bbd
Added configuration varibale to define the set of all available columns.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
99
diff
changeset
|
27 ], |
4
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 initComponent: function() { |
63
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
29 this.dockedItems = [ |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
30 { |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
31 xtype: 'toolbar', |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
32 dock: 'top', |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
33 items: [ |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
34 { |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
35 text: 'Hinzufügen', |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
36 icon: 'gfx/plus.gif', |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
37 action: 'add' |
357
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
353
diff
changeset
|
38 }, |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
353
diff
changeset
|
39 { |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
353
diff
changeset
|
40 text: 'Import', |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
353
diff
changeset
|
41 icon: 'gfx/plus.gif', |
94884cd8f8c0
Added logic to upload a file to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
353
diff
changeset
|
42 action: 'import' |
63
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
43 } |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
44 ] |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
45 } |
f7d40f8a6902
Added toolbar on the top of the proben listing.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
37
diff
changeset
|
46 ]; |
238
2a23fcca8ead
On Default the proben list will have no columns at all. The are added
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
237
diff
changeset
|
47 this.columns = []; |
4
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
48 this.callParent(arguments); |
239
f57b496b4caa
Added function to dynamically add columns to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
238
diff
changeset
|
49 }, |
348
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
50 /** |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
51 * Setup columns of the Grid dynamically based on a list of given cols. |
353
b8bd8d9a93ab
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
348
diff
changeset
|
52 * The function is called from the {@link Lada.controller.Sql#selectSql |
348
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
53 * select sql event} |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
54 * @parameter {Array} List of cols to show in the Grid. |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
55 */ |
249
81aca4dd5f0c
Simpliefied function to reconfigure the table.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
242
diff
changeset
|
56 setupColumns: function(cols) { |
364
d0f5be50aed5
Fixed syntax
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
363
diff
changeset
|
57 var rcols = []; |
258
62e92e470a1e
Fixed Issue44: Show locked or unlocked icon in the first column of the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
249
diff
changeset
|
58 rcols.push({header: 'RW', dataIndex: 'readonly', width: 30, renderer: render_readonly}); |
249
81aca4dd5f0c
Simpliefied function to reconfigure the table.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
242
diff
changeset
|
59 for (var i = cols.length - 1; i >= 0; i--){ |
81aca4dd5f0c
Simpliefied function to reconfigure the table.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
242
diff
changeset
|
60 rcols.push(cols[i]); |
364
d0f5be50aed5
Fixed syntax
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
363
diff
changeset
|
61 } |
249
81aca4dd5f0c
Simpliefied function to reconfigure the table.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
242
diff
changeset
|
62 this.reconfigure(this.store, rcols); |
4
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
63 } |
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
64 }); |
258
62e92e470a1e
Fixed Issue44: Show locked or unlocked icon in the first column of the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
249
diff
changeset
|
65 |
348
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
66 /** |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
67 * Helper function to render a readonly symbol per row in the grid |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
68 * @param {Boolean} flag if the symbol is a readonly symbol. |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
69 */ |
258
62e92e470a1e
Fixed Issue44: Show locked or unlocked icon in the first column of the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
249
diff
changeset
|
70 function render_readonly (value) { |
62e92e470a1e
Fixed Issue44: Show locked or unlocked icon in the first column of the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
249
diff
changeset
|
71 if (value) { |
363
3bed0373cf50
Fixed display of lock and unlock items.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
357
diff
changeset
|
72 return '<img src="gfx/lock_16x16.png"/>'; |
258
62e92e470a1e
Fixed Issue44: Show locked or unlocked icon in the first column of the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
249
diff
changeset
|
73 } else { |
363
3bed0373cf50
Fixed display of lock and unlock items.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
357
diff
changeset
|
74 return '<img src="gfx/unlock_16x16.png"/>'; |
258
62e92e470a1e
Fixed Issue44: Show locked or unlocked icon in the first column of the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
249
diff
changeset
|
75 } |
62e92e470a1e
Fixed Issue44: Show locked or unlocked icon in the first column of the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
249
diff
changeset
|
76 } |