Mercurial > lada > lada-client
comparison app/view/grid/FilterResult.js @ 548:d47ee7439f44
Added new js files.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 06 Mar 2015 12:43:52 +0100 |
parents | |
children | 199246596bf7 |
comparison
equal
deleted
inserted
replaced
547:f172b35a3b92 | 548:d47ee7439f44 |
---|---|
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 Proben | |
11 */ | |
12 Ext.define('Lada.view.grid.FilterResult', { | |
13 extend: 'Ext.grid.Panel', | |
14 alias: 'widget.filterresultgrid', | |
15 | |
16 store: 'ProbenList', | |
17 | |
18 multiSelect: true, | |
19 | |
20 viewConfig: { | |
21 emptyText: 'Keine Proben gefunden.', | |
22 deferEmptyText: false | |
23 }, | |
24 | |
25 initComponent: function() { | |
26 this.dockedItems = [{ | |
27 xtype: 'toolbar', | |
28 dock: 'top', | |
29 items: [{ | |
30 text: 'Hinzufügen', | |
31 icon: 'resources/img/list-add.png', | |
32 action: 'add' | |
33 }, { | |
34 text: 'Import', | |
35 icon: 'resources/img/svn-commit.png', | |
36 action: 'import' | |
37 }, { | |
38 text: 'Export', | |
39 icon: 'resources/img/svn-update.png', | |
40 action: 'export' | |
41 }] | |
42 }]; | |
43 this.columns = []; | |
44 this.callParent(arguments); | |
45 }, | |
46 | |
47 /** | |
48 * Setup columns of the Grid dynamically based on a list of given cols. | |
49 * The function is called from the {@link Lada.controller.Sql#selectSql | |
50 * select sql event} | |
51 */ | |
52 setupColumns: function(cols) { | |
53 var resultColumns = []; | |
54 var fields = []; | |
55 | |
56 resultColumns.push({ | |
57 header: 'RW', | |
58 dataIndex: 'readonly', | |
59 width: 30, | |
60 renderer: function(value) { | |
61 if (value) { | |
62 return '<img src="resources/img/lock_16x16.png"/>'; | |
63 } | |
64 return '<img src="resources/img/unlock_16x16.png"/>'; | |
65 } | |
66 }); | |
67 fields.push(new Ext.data.Field({ | |
68 name: 'readonly' | |
69 })); | |
70 for (var i = cols.length - 1; i >= 0; i--) { | |
71 if (cols[i] === 'id') { | |
72 continue; | |
73 } | |
74 resultColumns.push(cols[i]); | |
75 fields.push(new Ext.data.Field({ | |
76 name: cols[i].dataIndex | |
77 })); | |
78 } | |
79 this.store.model.setFields(fields); | |
80 this.reconfigure(this.store, resultColumns); | |
81 } | |
82 }); |