annotate app/view/widget/Deskriptor.js @ 1130:e4952906634d

Implemented insert, edit and delete for stammdaten.ort.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 25 May 2016 14:04:51 +0200
parents 81e7c847cb58
children
rev   line source
770
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Combobox for Deskriptor
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.widget.Deskriptor', {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Lada.view.widget.base.ComboBox',
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.deskriptor',
850
43f3a53d07d3 Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 849
diff changeset
15 displayField: 'id',
770
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 valueField: 'id',
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 // Enable filtering of comboboxes
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 triggerAction: 'all',
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 typeAhead: false,
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 layer: null,
849
8de4ec66d0e6 Fixed expanding.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 783
diff changeset
21 queryMode: 'remote',
8de4ec66d0e6 Fixed expanding.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 783
diff changeset
22 remoteFilter: true,
850
43f3a53d07d3 Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 849
diff changeset
23 tpl: Ext.create('Ext.XTemplate',
43f3a53d07d3 Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 849
diff changeset
24 '<tpl for="."><div class="x-combo-list-item x-boundlist-item" >' +
43f3a53d07d3 Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 849
diff changeset
25 '{sn} - {beschreibung}</div></tpl>'),
43f3a53d07d3 Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 849
diff changeset
26 displayTpl: Ext.create('Ext.XTemplate',
925
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
27 '<tpl for="."><tpl if="sn &gt; 0">{sn} - {beschreibung}</tpl></tpl>'),
849
8de4ec66d0e6 Fixed expanding.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 783
diff changeset
28
770
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 listeners: {
849
8de4ec66d0e6 Fixed expanding.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 783
diff changeset
30 focus: {
770
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 fn: function(field) {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 if (field.up('deskriptor').layer === 0) {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 field.store.proxy.extraParams = {'layer': field.up('deskriptor').layer};
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 }
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 else {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 var parents = field.up('deskriptor').getParents(this);
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 if (parents !== '') {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 field.store.proxy.extraParams = {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 'layer': field.up('deskriptor').layer,
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 'parents': parents
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 };
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 field.store.load();
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 }
925
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
44 else {
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
45 field.store.proxy.extraParams = {
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
46 'layer': field.up('deskriptor').layer
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
47 };
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
48 field.store.load();
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
49 }
770
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 }
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 }
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 },
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 initComponent: function() {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 this.store = Ext.create('Lada.store.Deskriptoren');
925
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
57 this.store.on('load', function() {
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
58 this.insert(0, {sn: 0, beschreibung: 'leer'});
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
59 if (this.proxy.extraParams.layer > 0 &&
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
60 !this.proxy.extraParams.parents) {
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
61 this.removeAll();
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
62 }
81e7c847cb58 Clear child descriptor fields on descriptor change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 850
diff changeset
63 }, this.store);
770
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 this.callParent(arguments);
783
afdbe3770b99 Exclude deskriptor fields from form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 770
diff changeset
66 this.down('combobox').isFormField = false;
770
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 },
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 getParents: function(field) {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 var set = field.up('fieldset');
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 var allS = set.items.items;
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 var p = '';
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 for (var i = 0; i < field.up('deskriptor').layer; i++) {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 if (allS[i].getValue() > 0) {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 p += allS[i].getValue();
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 if (i < field.up('deskriptor').layer - 1) {
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 p += ', ';
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 }
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 }
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 }
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 return p;
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 }
3185a77e8501 Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 });

http://lada.wald.intevation.org