comparison app/view/grid/ProbeList.js @ 975:fb99332bb48e stammdatengrids

Severe changes concerning the Resultgrids. - Intrduced "Stammdaten" which can be selected in the Mode Field on the left side, - Added Stores and Models for the Stammdaten - Removed the FilterResultgrid and replaced it with a model which uses inheritance. Dynamic Grid Columns can now be derived from app/view/widget/DynamicGrid.js For Proben and Messprogramme this is already done. - There might be some REGRESSION concerning the buttons in the ProbeList and MessprogrammeList grid, as those are not disabled properly. This needs to be fixed in future commits.
author Dustin Demuth <dustin@intevation.de>
date Wed, 02 Dec 2015 17:39:04 +0100
parents
children 56470a075e6e
comparison
equal deleted inserted replaced
974:ea477f62a667 975:fb99332bb48e
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8
9 /**
10 * Grid to list the result of the Filter
11 */
12 Ext.define('Lada.view.grid.ProbeList', {
13 extend: 'Lada.view.widget.DynamicGrid',
14 alias: 'widget.probelistgrid',
15
16 requires: 'Lada.view.window.DeleteProbe',
17
18 initComponent: function() {
19 var i18n = Lada.getApplication().bundle;
20 this.emptyText = i18n.getMsg('probe.emptyGrid');
21
22 this.dockedItems = [{
23 xtype: 'toolbar',
24 dock: 'top',
25 items: [{
26 xtype: 'tbtext',
27 id: 'tbtitle',
28 text: i18n.getMsg('probe.gridTitle')
29 },
30 '->',
31 {
32 text: i18n.getMsg('probe.button.create'),
33 icon: 'resources/img/list-add.png',
34 action: 'addProbe',
35 disabled: false
36 }, {
37 text: i18n.getMsg('probe.button.import'),
38 icon: 'resources/img/svn-commit.png',
39 action: 'import',
40 disabled: false
41 }, {
42 text: i18n.getMsg('probe.button.export'),
43 icon: 'resources/img/svn-update.png',
44 action: 'export'
45 }, {
46 text: i18n.getMsg('probe.button.print'),
47 icon: 'resources/img/printer.png',
48 action: 'print'
49 }]
50 }];
51 this.columns = [];
52 this.callParent(arguments);
53 },
54
55 /**
56 * Setup columns of the Grid dynamically based on a list of given cols.
57 * The function is called from the {@link Lada.controller.Filter#search
58 * search event}
59 * The Images for the Read-Write Icon are defined in CSS
60 * This Method overrides setupColumns of the parents class,
61 * becaus the delete colum is required.
62 */
63 setupColumns: function(cols) {
64 var caf = this.generateColumnsAndFields(cols);
65 var columns = caf[0];
66 var fields = caf[1];
67 var i18n = Lada.getApplication().bundle;
68
69 columns.push({
70 xtype: 'actioncolumn',
71 text: i18n.getMsg('action'),
72 sortable: false,
73 width: 30,
74 items: [{
75 icon: 'resources/img/edit-delete.png',
76 tooltip: i18n.getMsg('delete'),
77 isDisabled: function(grid, rowIndex, colIndex) {
78 var rec = grid.getStore().getAt(rowIndex);
79 if ( rec.get('readonly') || !rec.get('owner')) {
80 return true;
81 }
82 return false;
83 },
84 handler: function(grid, rowIndex, colIndex){
85 var rec = grid.getStore().getAt(rowIndex);
86
87 var winname = 'Lada.view.window.DeleteProbe';
88 var win = Ext.create(winname, {
89 record: rec,
90 parentWindow: this
91 });
92 win.show();
93 win.initData();
94 }
95 }]
96 });
97 this.store.model.setFields(fields);
98 this.reconfigure(this.store, columns);
99 }
100 });
101

http://lada.wald.intevation.org