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: raimund@548: /* 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, 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@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@683: beforeedit: function(e, o) { dustin@683: if (o.record.get('readonly') == true) { dustin@683: return false; dustin@683: } dustin@683: return true; dustin@683: } dustin@683: } dustin@683: }); 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 = [{ raimund@548: header: 'Erzeuger', raimund@548: dataIndex: 'erzeuger', raimund@572: width: 140, raimund@572: renderer: function(value) { raimund@572: if (!value || value === '') { raimund@572: return ''; raimund@572: } raimund@572: var store = Ext.data.StoreManager.get('messstellen'); raimund@572: var record = store.getById(value); raimund@572: return record.get('messStelle'); raimund@572: }, raimund@548: editor: { raimund@572: xtype: 'combobox', raimund@572: store: Ext.data.StoreManager.get('messstellen'), raimund@572: displayField: 'messStelle', raimund@572: valueField: 'id', raimund@548: allowBlank: false raimund@548: } raimund@548: }, { raimund@548: header: 'Datum', raimund@548: dataIndex: 'datum', raimund@548: editor: { raimund@548: xtype: 'datefield', raimund@548: allowBlank: false, raimund@548: format: 'd.m.Y', raimund@548: maxValue: Ext.Date.format(new Date(), 'd.m.Y') raimund@548: } raimund@548: }, { raimund@548: header: 'Text', raimund@548: dataIndex: 'text', raimund@548: flex: 1, raimund@572: renderer: function(value) { raimund@572: return '