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. raimund@530: minHeight: 65, torsten@94: deferEmptyText: false torsten@94: }, raimund@491: torsten@149: probeId: null, raimund@491: torsten@94: initComponent: function() { roland@510: var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { roland@510: clicksToMoveEditor: 1, roland@510: autoCancel: false roland@510: }); roland@510: this.plugins = [rowEditing]; 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@513: dock: 'bottom', raimund@513: items: ['->', { roland@522: text: 'Details', roland@522: icon: 'gfx/document-open.png', roland@522: action: 'open' roland@522: }, { 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', roland@510: dataIndex: 'ortsTyp', roland@510: editor: { roland@510: allowBlank: false roland@510: } 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@513: } roland@510: //editor: { roland@510: // allowBlank: false roland@510: //} 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@513: } roland@510: //editor: { roland@510: // allowBlank: false roland@510: //} raimund@491: }]; torsten@94: this.callParent(arguments); torsten@94: } torsten@94: });