Mercurial > lada > lada-client
annotate app/view/proben/List.js @ 537:a12c9c97d3cb
Make tables editable for 'Zusatzwerte'
See LSB 3.5
author | Roland Geider <roland.geider@intevation.de> |
---|---|
date | Wed, 17 Dec 2014 15:41:35 +0100 |
parents | 850ccfe5f3c4 |
children |
rev | line source |
---|---|
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
426
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:
426
diff
changeset
|
2 * Software engineering by Intevation GmbH |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
426
diff
changeset
|
3 * |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
426
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:
426
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
426
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
426
diff
changeset
|
7 */ |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
426
diff
changeset
|
8 |
348
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
9 /* |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
10 * Grid to list Proben |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
11 */ |
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
|
12 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
|
13 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
|
14 alias: 'widget.probenlist', |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
15 |
374
832e3c8f9191
Implemented dynamic ProbelList model. The model will get initialized by the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
364
diff
changeset
|
16 store: 'ProbenList', |
400
4fdc09ebf21d
Enable multiselect in probe list and download LAF export via POST request.
Raimund Renkert <rrenkert@intevation.de>
parents:
391
diff
changeset
|
17 multiSelect: true, |
37
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
18 viewConfig: { |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
19 emptyText: 'Keine Proben gefunden.', |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
20 deferEmptyText: false |
e9229d79e430
Added empty text message to the probenlist.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
30
diff
changeset
|
21 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
22 |
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
|
23 initComponent: function() { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
24 this.dockedItems = [{ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
25 xtype: 'toolbar', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
26 dock: 'top', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
27 items: [{ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
28 text: 'Hinzufügen', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
29 icon: 'gfx/list-add.png', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
30 action: 'add' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
31 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
32 text: 'Import', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
33 icon: 'gfx/svn-commit.png', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
34 action: 'import' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
35 }, { |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
36 text: 'Export', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
37 icon: 'gfx/svn-update.png', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
38 action: 'export' |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
39 }] |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
40 }]; |
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
|
41 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
|
42 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
|
43 }, |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
44 |
348
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
45 /** |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
46 * 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
|
47 * 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
|
48 * select sql event} |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
49 * @parameter {Array} List of cols to show in the Grid. |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
50 */ |
249
81aca4dd5f0c
Simpliefied function to reconfigure the table.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
242
diff
changeset
|
51 setupColumns: function(cols) { |
364
d0f5be50aed5
Fixed syntax
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
363
diff
changeset
|
52 var rcols = []; |
374
832e3c8f9191
Implemented dynamic ProbelList model. The model will get initialized by the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
364
diff
changeset
|
53 var mfields = []; |
832e3c8f9191
Implemented dynamic ProbelList model. The model will get initialized by the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
364
diff
changeset
|
54 |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
55 rcols.push({ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
56 header: 'RW', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
57 dataIndex: 'readonly', |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
58 width: 30, |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
59 renderer: render_readonly |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
60 }); |
374
832e3c8f9191
Implemented dynamic ProbelList model. The model will get initialized by the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
364
diff
changeset
|
61 mfields.push(new Ext.data.Field({name: 'readonly'})); |
249
81aca4dd5f0c
Simpliefied function to reconfigure the table.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
242
diff
changeset
|
62 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
|
63 rcols.push(cols[i]); |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
64 mfields.push(new Ext.data.Field({ |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
65 name: cols[i].dataIndex |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
66 })); |
364
d0f5be50aed5
Fixed syntax
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
363
diff
changeset
|
67 } |
374
832e3c8f9191
Implemented dynamic ProbelList model. The model will get initialized by the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
364
diff
changeset
|
68 this.store.model.setFields(mfields); |
249
81aca4dd5f0c
Simpliefied function to reconfigure the table.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
242
diff
changeset
|
69 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
|
70 } |
b8e56e880f02
Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
71 }); |
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
|
72 |
348
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
73 /** |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
74 * 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
|
75 * @param {Boolean} flag if the symbol is a readonly symbol. |
6007d11b81c2
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
258
diff
changeset
|
76 */ |
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
|
77 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
|
78 if (value) { |
363
3bed0373cf50
Fixed display of lock and unlock items.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
357
diff
changeset
|
79 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
|
80 } else { |
363
3bed0373cf50
Fixed display of lock and unlock items.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
357
diff
changeset
|
81 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
|
82 } |
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
|
83 } |