torsten@472: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz torsten@472: * Software engineering by Intevation GmbH torsten@472: * torsten@472: * This file is Free Software under the GNU GPL (v>=3) torsten@472: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@497: * the documentation coming with IMIS-Labordaten-Application for details. torsten@472: */ torsten@472: torsten@347: /* torsten@347: * Grid to list Orte torsten@347: */ raimund@497: Ext.define('Lada.view.orte.List', { torsten@94: extend: 'Ext.grid.Panel', torsten@94: alias: 'widget.ortelist', raimund@491: torsten@94: viewConfig: { torsten@94: maxHeight: 350, torsten@94: emptyText: 'Keine Orte gefunden.', torsten@94: // minHeight and deferEmptyText are needed to be able to show the torsten@94: // emptyText message. torsten@94: minHeight: 35, torsten@94: deferEmptyText: false torsten@94: }, raimund@491: torsten@149: probeId: null, raimund@491: torsten@94: initComponent: function() { raimund@490: this.store = Ext.data.StoreManager.get('Orte'); raimund@490: if (!this.store) { raimund@490: this.store = Ext.create('Lada.store.Orte'); raimund@490: } raimund@491: this.dockedItems = [{ raimund@491: xtype: 'toolbar', raimund@491: dock: 'top', raimund@491: items: [{ raimund@491: text: 'Hinzufügen', raimund@491: icon: 'gfx/list-add.png', raimund@491: action: 'add', raimund@491: probeId: this.probeId raimund@491: }, { raimund@491: text: 'Löschen', raimund@491: icon: 'gfx/list-remove.png', raimund@491: action: 'delete' raimund@491: }] raimund@491: }]; raimund@491: this.columns = [{ raimund@491: header: 'Typ', raimund@491: dataIndex: 'ortsTyp' raimund@491: }, { raimund@491: header: 'Staat', raimund@491: dataIndex: 'ortId', raimund@491: renderer: function(value) { raimund@496: var store = Ext.data.StoreManager.get('staOrte'); raimund@496: var staaten = Ext.data.StoreManager.get('staStaaten'); raimund@496: var record = raimund@496: staaten.getById(store.getById(value).get('staatId')); raimund@491: return record.get('staatIso'); torsten@94: } raimund@491: }, { raimund@491: header: 'Gemeineschlüssel', raimund@491: dataIndex: 'ortId', raimund@491: renderer: function(value) { raimund@496: var store = Ext.data.StoreManager.get('staOrte'); raimund@491: var record = store.getById(value); raimund@491: return record.get('gemId'); torsten@149: } raimund@491: }, { raimund@491: header: 'Gemeindename', raimund@491: dataIndex: 'ortId', raimund@491: flex: 1, raimund@491: renderer: function(value) { raimund@496: var store = Ext.data.StoreManager.get('staOrte'); raimund@496: var gemeinden = raimund@496: Ext.data.StoreManager.get('staVerwaltungseinheiten'); raimund@491: var record = store.getById(value); raimund@491: var gemid = record.get('gemId'); raimund@491: var record2 = gemeinden.getById(gemid); raimund@491: return record2.get('bezeichnung'); raimund@491: } raimund@491: }, { raimund@491: header: 'Messpunkt', raimund@491: dataIndex: 'ortId', raimund@491: renderer: function(value) { raimund@496: var store = Ext.getStore('staOrte'); raimund@491: var record = store.getById(value); raimund@491: return record.get('bezeichnung'); raimund@491: } raimund@491: }]; torsten@94: this.callParent(arguments); torsten@94: } torsten@94: });