dustin@1004: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz dustin@1004: * Software engineering by Intevation GmbH dustin@1004: * dustin@1004: * This file is Free Software under the GNU GPL (v>=3) dustin@1004: * and comes with ABSOLUTELY NO WARRANTY! Check out dustin@1004: * the documentation coming with IMIS-Labordaten-Application for details. dustin@1004: */ dustin@1004: dustin@1004: /** dustin@1004: * Grid to list Orte Stammdaten dustin@1004: */ dustin@1004: Ext.define('Lada.view.grid.Orte', { dustin@1004: extend: 'Ext.grid.Panel', dustin@1004: alias: 'widget.ortstammdatengrid', dustin@1004: dustin@1004: // minHeight and deferEmptyText are needed to be able to show the dustin@1004: // emptyText message. dustin@1004: minHeight: 110, dustin@1004: viewConfig: { dustin@1004: deferEmptyText: false dustin@1004: }, dustin@1004: dustin@1004: recordId: null, dustin@1004: dustin@1004: warnings: null, dustin@1004: errors: null, dustin@1004: readOnly: true, dustin@1004: allowDeselect: true, raimund@1050: editableGrid: true, dustin@1004: dustin@1004: initComponent: function() { dustin@1004: var i18n = Lada.getApplication().bundle; dustin@1004: this.emptyText = i18n.getMsg('orte.emptyGrid'); dustin@1004: raimund@1050: if (this.editableGrid) { raimund@1050: this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { raimund@1050: clicksToMoveEditor: 1, raimund@1050: autoCancel: false, raimund@1050: disabled: false, raimund@1050: pluginId: 'rowedit' raimund@1050: }); raimund@1050: this.plugins = [this.rowEditing]; raimund@1050: } raimund@1049: dustin@1004: this.columns = [{ dustin@1004: header: i18n.getMsg('orte.ortId'), dustin@1004: dataIndex: 'ortId' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.nutsCode'), dustin@1004: dataIndex: 'nutsCode' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.anlageId'), dustin@1004: dataIndex: 'anlageId' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.gemId'), dustin@1004: dataIndex: 'gemId', dustin@1004: width: 120, dustin@1004: renderer: function(value) { dustin@1004: var store = Ext.data.StoreManager.get('verwaltungseinheiten'); dustin@1004: var record = store.getById(value); dustin@1004: return record.get('bezeichnung'); dustin@1004: } dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.staatId'), dustin@1004: dataIndex: 'staatId', dustin@1004: width: 70, dustin@1004: renderer: function(value) { dustin@1004: var staaten = Ext.data.StoreManager.get('staaten'); dustin@1004: var record = staaten.getById(value); dustin@1004: return record.get('staatIso'); dustin@1004: } dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.kdaId'), dustin@1004: dataIndex: 'kdaId' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.ozId'), dustin@1004: dataIndex: 'ozId' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.ortTyp'), dustin@1004: dataIndex: 'ortTyp' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.mpArt'), dustin@1004: dataIndex: 'mpArt' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.zone'), dustin@1004: dataIndex: 'zone' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.sektor'), dustin@1004: dataIndex: 'sektor' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.zustaendigkeit'), dustin@1004: dataIndex: 'zustaendigkeit' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.berichtstext'), dustin@1004: dataIndex: 'berichtstext' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.kurztext'), dustin@1004: dataIndex: 'kurztext' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.langtext'), dustin@1004: dataIndex: 'langtext' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.beschreibung'), dustin@1004: dataIndex: 'beschreibung' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.unscharf'), dustin@1004: dataIndex: 'unscharf' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.hoeheLand'), dustin@1004: dataIndex: 'hoeheLand' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.koordXExtern'), dustin@1004: dataIndex: 'koordXExtern' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.koordYExtern'), dustin@1004: dataIndex: 'koordYExtern' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.longitude'), dustin@1004: dataIndex: 'longitude' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.latitude'), dustin@1004: dataIndex: 'latitude' dustin@1004: }, { dustin@1004: header: i18n.getMsg('orte.letzteAenderung'), dustin@1004: dataIndex: 'letzteAenderung' dustin@1004: }]; dustin@1004: this.callParent(arguments); dustin@1004: }, dustin@1004: dustin@1004: /** dustin@1004: * This sets the Store of this Grid dustin@1004: */ dustin@1004: setStore: function(store){ dustin@1004: var i18n = Lada.getApplication().bundle; dustin@1004: dustin@1004: if (store) { dustin@1004: this.reconfigure(store); dustin@1021: dustin@1021: var ptbar = this.down('pagingtoolbar'); dustin@1021: if (ptbar) { dustin@1021: this.removeDocked(ptbar); dustin@1021: } dustin@1021: dustin@1021: if (store.pageSize > 0) { dustin@1021: this.addDocked([{ dustin@1021: xtype: 'pagingtoolbar', dustin@1021: dock: 'bottom', dustin@1021: store: store, dustin@1021: displayInfo: true dustin@1021: }]); dustin@1021: } dustin@1004: } raimund@1049: }, raimund@1049: raimund@1049: selectOrt: function(map, feature) { raimund@1049: var id = feature[0].data.id; raimund@1049: var record = this.store.getById(id); raimund@1049: this.getSelectionModel().select(record); dustin@1004: } dustin@1004: });