comparison app/view/grid/Orte.js @ 1308:6075731bc4f1

Added column filter to orte grid.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 02 Feb 2017 16:43:53 +0100
parents 5dfd5798cbcc
children 46093e6f45d2
comparison
equal deleted inserted replaced
1307:152fca74a839 1308:6075731bc4f1
11 */ 11 */
12 Ext.define('Lada.view.grid.Orte', { 12 Ext.define('Lada.view.grid.Orte', {
13 extend: 'Ext.grid.Panel', 13 extend: 'Ext.grid.Panel',
14 alias: 'widget.ortstammdatengrid', 14 alias: 'widget.ortstammdatengrid',
15 15
16 requires: [
17 'Ext.ux.grid.FiltersFeature'
18 ],
16 // minHeight and deferEmptyText are needed to be able to show the 19 // minHeight and deferEmptyText are needed to be able to show the
17 // emptyText message. 20 // emptyText message.
18 minHeight: 110, 21 minHeight: 110,
19 viewConfig: { 22 viewConfig: {
20 deferEmptyText: false 23 deferEmptyText: false
25 warnings: null, 28 warnings: null,
26 errors: null, 29 errors: null,
27 readOnly: true, 30 readOnly: true,
28 allowDeselect: true, 31 allowDeselect: true,
29 editableGrid: true, 32 editableGrid: true,
33 features: [],
30 34
31 initComponent: function() { 35 initComponent: function() {
32 var i18n = Lada.getApplication().bundle; 36 var i18n = Lada.getApplication().bundle;
33 this.emptyText = i18n.getMsg('orte.emptyGrid'); 37 this.emptyText = i18n.getMsg('orte.emptyGrid');
34 38
40 pluginId: 'rowedit' 44 pluginId: 'rowedit'
41 }); 45 });
42 this.plugins = [this.rowEditing]; 46 this.plugins = [this.rowEditing];
43 } 47 }
44 48
49 filters = {
50 ftype: 'filters',
51 // encode and local configuration options defined previously for easier reuse
52 encode: false, // json encode the filter query
53 local: true, // defaults to false (remote filtering)
54
55 // Filters are most naturally placed in the column definition, but can also be
56 // added here.
57 filters: [{
58 type: 'boolean',
59 dataIndex: 'visible'
60 }]
61 };
62 this.features = [filters];
63
45 this.columns = [{ 64 this.columns = [{
46 xtype: 'actioncolumn', 65 xtype: 'actioncolumn',
47 text: 'RW', 66 text: 'RW',
48 dataIndex: 'readonly', 67 dataIndex: 'readonly',
49 sortable: false, 68 sortable: false,
81 editor: { 100 editor: {
82 xtype: 'textfield', 101 xtype: 'textfield',
83 maxLength: 10, 102 maxLength: 10,
84 allowBlank: false 103 allowBlank: false
85 }, 104 },
105 filter: {
106 type: 'string'
107 },
86 dataIndex: 'ortId' 108 dataIndex: 'ortId'
87 }, { 109 }, {
88 header: i18n.getMsg('orte.nutsCode'), 110 header: i18n.getMsg('orte.nutsCode'),
89 editor: { 111 editor: {
90 xtype: 'textfield', 112 xtype: 'textfield',
91 maxLength: 10 113 maxLength: 10
114 },
115 filter: {
116 type: 'string'
92 }, 117 },
93 dataIndex: 'nutsCode' 118 dataIndex: 'nutsCode'
94 }, { 119 }, {
95 header: i18n.getMsg('orte.anlageId'), 120 header: i18n.getMsg('orte.anlageId'),
96 editor: { 121 editor: {
99 dataIndex: 'anlageId' 124 dataIndex: 'anlageId'
100 }, { 125 }, {
101 header: i18n.getMsg('orte.verwaltungseinheit'), 126 header: i18n.getMsg('orte.verwaltungseinheit'),
102 dataIndex: 'gemId', 127 dataIndex: 'gemId',
103 width: 120, 128 width: 120,
129 filter: {
130 type: 'string'
131 },
104 renderer: function(value) { 132 renderer: function(value) {
105 if (!value) { 133 if (!value) {
106 return ''; 134 return '';
107 } 135 }
108 var store = Ext.data.StoreManager.get('verwaltungseinheiten'); 136 var store = Ext.data.StoreManager.get('verwaltungseinheiten');
118 } 146 }
119 }, { 147 }, {
120 header: i18n.getMsg('orte.staatId'), 148 header: i18n.getMsg('orte.staatId'),
121 dataIndex: 'staatId', 149 dataIndex: 'staatId',
122 width: 70, 150 width: 70,
151 filter: {
152 type: 'string'
153 },
123 renderer: function(value) { 154 renderer: function(value) {
124 if (value === undefined || value === '') { 155 if (value === undefined || value === '') {
125 return ''; 156 return '';
126 } 157 }
127 var staaten = Ext.data.StoreManager.get('staaten'); 158 var staaten = Ext.data.StoreManager.get('staaten');
135 valueField: 'id', 166 valueField: 'id',
136 allowBlank: false 167 allowBlank: false
137 } 168 }
138 }, { 169 }, {
139 header: i18n.getMsg('orte.kdaId'), 170 header: i18n.getMsg('orte.kdaId'),
171 filter: {
172 type: 'numeric'
173 },
140 editor: { 174 editor: {
141 xtype: 'numberfield', 175 xtype: 'numberfield',
142 allowBlank: false 176 allowBlank: false
143 }, 177 },
144 dataIndex: 'kdaId' 178 dataIndex: 'kdaId'
145 }, { 179 }, {
146 header: i18n.getMsg('orte.ozId'), 180 header: i18n.getMsg('orte.ozId'),
181 filter: {
182 type: 'string'
183 },
147 dataIndex: 'ozId' 184 dataIndex: 'ozId'
148 }, { 185 }, {
149 header: i18n.getMsg('orte.ortTyp'), 186 header: i18n.getMsg('orte.ortTyp'),
187 filter: {
188 type: 'numeric'
189 },
150 dataIndex: 'ortTyp' 190 dataIndex: 'ortTyp'
151 }, { 191 }, {
152 header: i18n.getMsg('orte.mpArt'), 192 header: i18n.getMsg('orte.mpArt'),
193 filter: {
194 type: 'string'
195 },
153 editor: { 196 editor: {
154 xtype: 'textfield', 197 xtype: 'textfield',
155 maxLength: 10 198 maxLength: 10
156 }, 199 },
157 dataIndex: 'mpArt' 200 dataIndex: 'mpArt'
158 }, { 201 }, {
159 header: i18n.getMsg('orte.zone'), 202 header: i18n.getMsg('orte.zone'),
203 filter: {
204 type: 'string'
205 },
160 editor: { 206 editor: {
161 xtype: 'textfield', 207 xtype: 'textfield',
162 maxLength: 1 208 maxLength: 1
163 }, 209 },
164 dataIndex: 'zone' 210 dataIndex: 'zone'
165 }, { 211 }, {
166 header: i18n.getMsg('orte.sektor'), 212 header: i18n.getMsg('orte.sektor'),
213 filter: {
214 type: 'string'
215 },
167 editor: { 216 editor: {
168 xtype: 'textfield', 217 xtype: 'textfield',
169 maxLength: 2 218 maxLength: 2
170 }, 219 },
171 dataIndex: 'sektor' 220 dataIndex: 'sektor'
172 }, { 221 }, {
173 header: i18n.getMsg('orte.zustaendigkeit'), 222 header: i18n.getMsg('orte.zustaendigkeit'),
223 filter: {
224 type: 'string'
225 },
174 editor: { 226 editor: {
175 xtype: 'textfield', 227 xtype: 'textfield',
176 maxLength: 10 228 maxLength: 10
177 }, 229 },
178 dataIndex: 'zustaendigkeit' 230 dataIndex: 'zustaendigkeit'
179 }, { 231 }, {
180 header: i18n.getMsg('orte.berichtstext'), 232 header: i18n.getMsg('orte.berichtstext'),
233 filter: {
234 type: 'string'
235 },
181 editor: { 236 editor: {
182 xtype: 'textfield', 237 xtype: 'textfield',
183 maxLength: 70 238 maxLength: 70
184 }, 239 },
185 dataIndex: 'berichtstext' 240 dataIndex: 'berichtstext'
186 }, { 241 }, {
187 header: i18n.getMsg('orte.kurztext'), 242 header: i18n.getMsg('orte.kurztext'),
243 filter: {
244 type: 'string'
245 },
188 editor: { 246 editor: {
189 xtype: 'textfield', 247 xtype: 'textfield',
190 maxLength: 15, 248 maxLength: 15,
191 allowBlank: false 249 allowBlank: false
192 }, 250 },
193 dataIndex: 'kurztext' 251 dataIndex: 'kurztext'
194 }, { 252 }, {
195 header: i18n.getMsg('orte.langtext'), 253 header: i18n.getMsg('orte.langtext'),
254 filter: {
255 type: 'string'
256 },
196 editor: { 257 editor: {
197 xtype: 'textfield', 258 xtype: 'textfield',
198 maxLength: 100, 259 maxLength: 100,
199 allowBlank: false 260 allowBlank: false
200 }, 261 },
201 dataIndex: 'langtext' 262 dataIndex: 'langtext'
202 }, { 263 }, {
203 header: i18n.getMsg('orte.unscharf'), 264 header: i18n.getMsg('orte.unscharf'),
265 filter: {
266 type: 'string'
267 },
204 editor: { 268 editor: {
205 xtype: 'textfield' 269 xtype: 'textfield'
206 }, 270 },
207 dataIndex: 'unscharf' 271 dataIndex: 'unscharf'
208 }, { 272 }, {
209 header: i18n.getMsg('orte.hoeheLand'), 273 header: i18n.getMsg('orte.hoeheLand'),
274 filter: {
275 type: 'numeric'
276 },
210 editor: { 277 editor: {
211 xtype: 'numberfield' 278 xtype: 'numberfield'
212 }, 279 },
213 dataIndex: 'hoeheLand' 280 dataIndex: 'hoeheLand'
214 }, { 281 }, {
215 header: i18n.getMsg('orte.koordXExtern'), 282 header: i18n.getMsg('orte.koordXExtern'),
283 filter: {
284 type: 'string'
285 },
216 editor: { 286 editor: {
217 xtype: 'textfield', 287 xtype: 'textfield',
218 maxLength: 22, 288 maxLength: 22,
219 allowBlank: false 289 allowBlank: false
220 }, 290 },
221 dataIndex: 'koordXExtern' 291 dataIndex: 'koordXExtern'
222 }, { 292 }, {
223 header: i18n.getMsg('orte.koordYExtern'), 293 header: i18n.getMsg('orte.koordYExtern'),
294 filter: {
295 type: 'string'
296 },
224 editor: { 297 editor: {
225 xtype: 'textfield', 298 xtype: 'textfield',
226 maxLength: 22, 299 maxLength: 22,
227 allowBlank: false 300 allowBlank: false
228 }, 301 },
229 dataIndex: 'koordYExtern' 302 dataIndex: 'koordYExtern'
230 }, { 303 }, {
231 header: i18n.getMsg('orte.longitude'), 304 header: i18n.getMsg('orte.longitude'),
305 filter: {
306 type: 'numeric'
307 },
232 editor: { 308 editor: {
233 xtype: 'numberfield' 309 xtype: 'numberfield'
234 }, 310 },
235 dataIndex: 'longitude' 311 dataIndex: 'longitude'
236 }, { 312 }, {
237 header: i18n.getMsg('orte.latitude'), 313 header: i18n.getMsg('orte.latitude'),
314 filter: {
315 type: 'numeric'
316 },
238 editor: { 317 editor: {
239 xtype: 'numberfield' 318 xtype: 'numberfield'
240 }, 319 },
241 dataIndex: 'latitude' 320 dataIndex: 'latitude'
242 }, { 321 }, {
243 header: i18n.getMsg('letzteAenderung'), 322 header: i18n.getMsg('letzteAenderung'),
323 filter: {
324 type: 'date'
325 },
244 xtype: 'datecolumn', 326 xtype: 'datecolumn',
245 format: 'd.m.Y H:i', 327 format: 'd.m.Y H:i',
246 dataIndex: 'letzteAenderung' 328 dataIndex: 'letzteAenderung'
247 }]; 329 }];
248 this.callParent(arguments); 330 this.callParent(arguments);

http://lada.wald.intevation.org