Mercurial > lada > lada-client
comparison app/view/panel/Ort.js @ 1021:1df6b6210b42 stammdatengrids
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 04 Feb 2016 16:31:46 +0100 |
parents | |
children | 1bd4c0709bd6 |
comparison
equal
deleted
inserted
replaced
1014:e9e974d31924 | 1021:1df6b6210b42 |
---|---|
1 Ext.define('Lada.view.panel.Ort', { | |
2 extend: 'Ext.panel.Panel', | |
3 alias: 'widget.ortpanel', | |
4 | |
5 requires: [ | |
6 'Lada.view.panel.Map', | |
7 'Lada.view.grid.Orte' | |
8 ], | |
9 | |
10 width: '100%', | |
11 //height: 200, | |
12 | |
13 layout: { | |
14 type: 'border', | |
15 }, | |
16 toolbarPos: 'top', | |
17 | |
18 initComponent: function() { | |
19 var i18n = Lada.getApplication().bundle; | |
20 | |
21 // Different Layout of toolbar depending on the bars position. | |
22 if (this.toolbarPos == 'top') { | |
23 this.dockedItems = [{ | |
24 xtype: 'toolbar', | |
25 dock: 'top', | |
26 items: [{ | |
27 xtype: 'tbtext', | |
28 text: i18n.getMsg('orte.gridTitle') | |
29 }, | |
30 '->', | |
31 { | |
32 text: i18n.getMsg('map.button.add'), | |
33 icon: 'resources/img/list-add.png', | |
34 action: 'addMap', | |
35 disabled: true // disabled on startup, will be enabled by setStore | |
36 }, { | |
37 text: i18n.getMsg('orte.button.add'), | |
38 icon: 'resources/img/list-add.png', | |
39 action: 'add', | |
40 disabled: true // disabled on startup, will be enabled by setStore | |
41 }, { | |
42 text: i18n.getMsg('orte.button.delete'), | |
43 icon: 'resources/img/list-remove.png', | |
44 action: 'delete', | |
45 disabled: true // disabled on startup, will be enabled by controller if necessary | |
46 }] | |
47 }]; | |
48 } | |
49 else { | |
50 this.dockedItems = [{ | |
51 xtype: 'toolbar', | |
52 dock: this.toolbarPos, | |
53 items: [ '->', | |
54 { | |
55 text: i18n.getMsg('map.button.add'), | |
56 icon: 'resources/img/list-add.png', | |
57 action: 'addMap', | |
58 disabled: true // disabled on startup, will be enabled by setStore | |
59 }, { | |
60 text: i18n.getMsg('orte.button.add'), | |
61 icon: 'resources/img/list-add.png', | |
62 action: 'add', | |
63 disabled: true // disabled on startup, will be enabled by setStore | |
64 }] | |
65 }]; | |
66 } | |
67 | |
68 this.items = [{ | |
69 xtype: 'ortstammdatengrid', | |
70 width: '60%', | |
71 collapsible: true, | |
72 region: 'east', | |
73 }, { | |
74 xtype: 'map', | |
75 region: 'center', | |
76 layout: 'border', | |
77 title: i18n.getMsg('map.title'), | |
78 externalOrteStore: true, | |
79 listeners: { | |
80 beforecollapse: function() { | |
81 var c = this.map.getControlsByClass('OpenLayers.Control.ScaleLine'); | |
82 this.map.removeControl(c[0]); | |
83 }, | |
84 expand: function() { | |
85 this.map.addControl(new OpenLayers.Control.ScaleLine()); | |
86 } | |
87 } | |
88 }], | |
89 | |
90 this.callParent(arguments); | |
91 }, | |
92 | |
93 setStore: function(store) { | |
94 var me = this; | |
95 var osg = this.down('ortstammdatengrid'); | |
96 var map = this.down('map'); | |
97 | |
98 if (!store) { | |
99 var ortstore = Ext.create('Lada.store.Orte', { | |
100 defaultPageSize: 0, | |
101 listeners: { | |
102 beforeload: { | |
103 fn: function() { | |
104 osg.setLoading(true); | |
105 map.setLoading(true); | |
106 } | |
107 }, | |
108 load: { | |
109 fn: function() { | |
110 osg.setLoading(false); | |
111 map.setLoading(false); | |
112 osg.setStore(ortstore); | |
113 map.addLocations(ortstore); | |
114 | |
115 } | |
116 } | |
117 } | |
118 }); | |
119 } | |
120 else { | |
121 osg.setStore(store); | |
122 map.addLocations(store); | |
123 } | |
124 //enable buttons | |
125 me.down('toolbar button[action=add]').enable(); | |
126 me.down('toolbar button[action=addMap]').enable(); | |
127 } | |
128 }); |