raimund@596: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz raimund@596: * Software engineering by Intevation GmbH raimund@596: * raimund@596: * This file is Free Software under the GNU GPL (v>=3) raimund@596: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@596: * the documentation coming with IMIS-Labordaten-Application for details. raimund@596: */ raimund@596: dustin@893: /** raimund@596: * Grid to list Kommentare for Messunge raimund@596: */ raimund@596: Ext.define('Lada.view.grid.MKommentar', { raimund@596: extend: 'Ext.grid.Panel', raimund@596: alias: 'widget.mkommentargrid', raimund@596: raimund@596: maxHeight: 350, raimund@596: emptyText: 'Keine Kommentare gefunden.', raimund@596: minHeight: 110, raimund@596: viewConfig: { raimund@596: deferEmptyText: false raimund@596: }, raimund@596: raimund@596: recordId: null, dustin@824: readOnly: true, dustin@824: allowDeselect: true, raimund@596: raimund@596: initComponent: function() { raimund@596: this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { raimund@596: 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@596: this.plugins = [this.rowEditing]; raimund@596: this.dockedItems = [{ raimund@596: xtype: 'toolbar', raimund@596: dock: 'bottom', raimund@596: items: ['->', { raimund@596: text: 'Hinzufügen', raimund@596: icon: 'resources/img/list-add.png', raimund@596: action: 'add' raimund@596: }, { raimund@596: text: 'Löschen', raimund@596: icon: 'resources/img/list-remove.png', raimund@596: action: 'delete' raimund@596: }] raimund@596: }]; raimund@596: 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@596: header: 'Erzeuger', raimund@596: dataIndex: 'erzeuger', raimund@596: renderer: function(value) { dustin@959: var r = ''; raimund@596: if (!value || value === '') { dustin@959: r = 'Error'; raimund@596: } dustin@959: var store = Ext.data.StoreManager.get('messstellen'); dustin@959: var record = store.getById(value); dustin@959: if (record) { dustin@959: r = record.get('messStelle'); dustin@959: } dustin@959: return r; raimund@596: }, raimund@596: editor: { raimund@596: xtype: 'combobox', dustin@971: store: Ext.data.StoreManager.get('messstellenFiltered'), raimund@596: displayField: 'messStelle', raimund@596: valueField: 'id', dustin@664: allowBlank: false, dustin@718: editable: false raimund@596: } raimund@596: }, { raimund@596: header: 'Text', raimund@596: dataIndex: 'text', raimund@596: flex: 1, ehuber@1172: renderer: function(value) { ehuber@1172: return '