raimund@548: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz raimund@548: * Software engineering by Intevation GmbH raimund@548: * raimund@548: * This file is Free Software under the GNU GPL (v>=3) raimund@548: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@548: * the documentation coming with IMIS-Labordaten-Application for details. raimund@548: */ raimund@548: dustin@893: /** raimund@548: * Grid to list Kommentare raimund@548: */ raimund@548: Ext.define('Lada.view.grid.PKommentar', { raimund@548: extend: 'Ext.grid.Panel', raimund@548: alias: 'widget.pkommentargrid', raimund@548: raimund@548: requires: [ raimund@572: 'Ext.toolbar.Toolbar', raimund@572: 'Lada.store.PKommentare' raimund@548: ], raimund@548: raimund@548: maxHeight: 350, raimund@548: emptyText: 'Keine Kommentaregefunden.', raimund@572: minHeight: 110, raimund@548: viewConfig: { raimund@548: deferEmptyText: false raimund@548: }, raimund@548: raimund@548: recordId: null, dustin@823: readOnly: true, dustin@823: allowDeselect: true, raimund@548: raimund@548: initComponent: function() { raimund@572: this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { raimund@548: clicksToMoveEditor: 1, dustin@683: autoCancel: false, dustin@703: disabled: false, dustin@684: pluginId: 'rowedit', dustin@683: listeners:{ dustin@683: // Make row ineditable when readonly is set to true dustin@683: // Normally this would belong into a controller an not the view. dustin@703: // But the RowEditPlugin is not handled there. dustin@683: beforeedit: function(e, o) { dustin@703: var readonlywin = o.grid.up('window').record.get('readonly'); dustin@703: var readonlygrid = o.record.get('readonly'); dustin@703: if (readonlywin == true || readonlygrid == true || this.disabled) { dustin@683: return false; dustin@683: } dustin@683: return true; dustin@683: } dustin@683: } dustin@703: }); raimund@572: this.plugins = [this.rowEditing]; raimund@548: this.dockedItems = [{ raimund@548: xtype: 'toolbar', raimund@548: dock: 'bottom', raimund@548: items: ['->', { raimund@548: text: 'Hinzufügen', raimund@548: icon: 'resources/img/list-add.png', raimund@548: action: 'add', raimund@548: probeId: this.probeId raimund@548: }, { raimund@548: text: 'Löschen', raimund@548: icon: 'resources/img/list-remove.png', raimund@548: action: 'delete' raimund@548: }] raimund@548: }]; raimund@548: this.columns = [{ mstanko@943: header: 'erstellt', mstanko@943: dataIndex: 'datum', mstanko@943: xtype: 'datecolumn', mstanko@943: format: 'd.m.Y H:i', dustin@966: width: 110 mstanko@943: }, { raimund@548: header: 'Erzeuger', raimund@1174: dataIndex: 'mstId', raimund@572: width: 140, raimund@572: renderer: function(value) { dustin@959: var r = ''; raimund@572: if (!value || value === '') { dustin@959: r = 'Error'; raimund@572: } raimund@572: var store = Ext.data.StoreManager.get('messstellen'); raimund@572: var record = store.getById(value); dustin@959: if (record) { dustin@959: r = record.get('messStelle'); dustin@959: } dustin@959: return r; raimund@572: }, raimund@548: editor: { raimund@572: xtype: 'combobox', dustin@971: store: Ext.data.StoreManager.get('messstellenFiltered'), raimund@572: displayField: 'messStelle', raimund@572: valueField: 'id', raimund@548: allowBlank: false raimund@548: } raimund@548: }, { raimund@548: header: 'Text', raimund@548: dataIndex: 'text', raimund@548: flex: 1, raimund@572: renderer: function(value) { raimund@572: return '