annotate app/view/grid/FilterResult.js @ 761:975183ab775e

Sending Date as timestamp
author Dustin Demuth <dustin@intevation.de>
date Fri, 08 May 2015 11:49:15 +0200
parents 3637c453f67d
children d572ee3271ac
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
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
16 store: null, //'ProbenList',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 multiSelect: true,
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 viewConfig: {
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
21 emptyText: 'Keine Ergebnisse gefunden.',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 deferEmptyText: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 initComponent: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 this.dockedItems = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 xtype: 'toolbar',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 dock: 'top',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 items: [{
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
30 xtype: 'tbtext',
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
31 id: 'tbtitle',
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
32 text: '',
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
33 },
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
34 '->',
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
35 {
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
36 text: 'Probe erstellen',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 icon: 'resources/img/list-add.png',
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
38 action: 'addProbe'
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 }, {
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
40 text: 'Messprogramm erstellen',
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
41 icon: 'resources/img/list-add.png',
755
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 753
diff changeset
42 action: 'addMessprogramm'
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
43 },
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
44 '-',
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
45 {
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
46 text: 'Proben Importieren',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 icon: 'resources/img/svn-commit.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 action: 'import'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 }, {
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
50 text: 'Proben Exportieren',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 icon: 'resources/img/svn-update.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 action: 'export'
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
53 }
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
54 ]
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 this.columns = [];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 /**
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
61 * This sets the Store of the FilterResultGrid
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
62 */
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
63 setStore: function(store){
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
64 var i18n = Lada.getApplication().bundle;
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
65
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
66 this.removeDocked(Ext.getCmp('ptbar'), true);
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
67 this.reconfigure(store);
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
68 this.addDocked([{
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
69 xtype: 'pagingtoolbar',
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
70 id: 'ptbar',
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
71 dock: 'bottom',
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
72 store: store,
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
73 displayInfo: true
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
74 }]);
753
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
75
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
76 //Reset the Text int the Toolbar.
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
77 var t = Ext.getCmp('tbtitle');
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
78 if (store.model.modelName == 'Lada.model.MessprogrammList') {
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
79 t.setText(i18n.getMsg('probeplanning'));
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
80 }
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
81 else if (store.model.modelName == 'Lada.model.ProbeList') {
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
82 t.setText(i18n.getMsg('probelist'));
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
83 }
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
84 else {
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
85 t.setText('');
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
86 console.log('The model '+store.model.modelName+
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
87 'was not defined in the FilterResultGrid.' +
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
88 ' Hence the title could not be set.');
4dd0c645ea8b Display a Title in the Toolbar
Dustin Demuth <dustin@intevation.de>
parents: 751
diff changeset
89 }
751
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
90 },
704bb359c0fe dynamically exchange the store of the resultfiltergrid
Dustin Demuth <dustin@intevation.de>
parents: 682
diff changeset
91 /**
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 * Setup columns of the Grid dynamically based on a list of given cols.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 * The function is called from the {@link Lada.controller.Sql#selectSql
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 * select sql event}
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 setupColumns: function(cols) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 var resultColumns = [];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 var fields = [];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 resultColumns.push({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 header: 'RW',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 dataIndex: 'readonly',
682
7b6467edfdfc RW Column may not be sortable
Dustin Demuth <dustin@intevation.de>
parents: 656
diff changeset
103 sortable: false,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 width: 30,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 renderer: function(value) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 if (value) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 return '<img src="resources/img/lock_16x16.png"/>';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 return '<img src="resources/img/unlock_16x16.png"/>';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 fields.push(new Ext.data.Field({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 name: 'readonly'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 }));
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 for (var i = cols.length - 1; i >= 0; i--) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 if (cols[i] === 'id') {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 continue;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 resultColumns.push(cols[i]);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 fields.push(new Ext.data.Field({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 name: cols[i].dataIndex
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 }));
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 this.store.model.setFields(fields);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 this.reconfigure(this.store, resultColumns);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 });

http://lada.wald.intevation.org