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@345: /* torsten@345: * Grid to list Messwerte torsten@345: */ raimund@497: Ext.define('Lada.view.messwerte.List', { torsten@183: extend: 'Ext.grid.Panel', torsten@183: alias: 'widget.messwertelist', raimund@491: torsten@183: store: 'Messwerte', torsten@183: viewConfig: { torsten@183: maxHeight: 350, torsten@183: emptyText: 'Keine Messwerte gefunden.', torsten@183: // minHeight and deferEmptyText are needed to be able to show the torsten@183: // emptyText message. raimund@530: minHeight: 65, torsten@183: deferEmptyText: false torsten@183: }, raimund@491: torsten@183: probeId: null, torsten@210: parentId: null, raimund@491: torsten@183: initComponent: function() { roland@525: var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { roland@525: clicksToMoveEditor: 1, roland@525: autoCancel: false roland@525: }); roland@525: roland@525: this.plugins = [rowEditing]; roland@525: raimund@491: this.dockedItems = [{ raimund@491: xtype: 'toolbar', raimund@513: dock: 'bottom', raimund@513: items: ['->', { roland@540: text: 'Details', roland@540: icon: 'gfx/document-open.png', roland@545: action: 'open', roland@545: disabled: true roland@540: }, { raimund@491: text: 'Hinzufügen', raimund@491: icon: 'gfx/list-add.png', raimund@491: action: 'add', raimund@491: probeId: this.probeId, raimund@491: parentId: this.parentId 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: '<NWG', roland@525: dataIndex: 'messwertNwg', roland@525: editor: { roland@534: xtype: 'nwg', roland@525: allowBlank: false roland@525: } raimund@491: }, { raimund@491: header: 'Messwert', roland@525: dataIndex: 'messwert', roland@525: editor: { roland@525: xtype: 'numberfield', roland@525: allowBlank: false roland@525: } raimund@491: }, { raimund@491: header: 'Messfehler', roland@525: dataIndex: 'messfehler', roland@525: editor: { roland@525: xtype: 'numberfield', roland@525: allowBlank: false roland@525: } raimund@491: }, { raimund@491: header: 'Messgröße', raimund@491: dataIndex: 'messgroesseId', raimund@491: renderer: function(value) { raimund@496: var store = Ext.data.StoreManager.get('staMessgroessen'); raimund@491: return store.findRecord('id', value).get('messgroesse'); roland@525: }, roland@525: editor: { roland@525: xtype: 'messgroesse', roland@525: allowBlank: false torsten@183: } raimund@491: }, { raimund@491: header: 'Messeinheit', raimund@491: dataIndex: 'mehId', raimund@491: renderer: function(value) { raimund@496: var store = Ext.data.StoreManager.get('staMesseinheiten'); raimund@491: return store.findRecord('id', value).get('einheit'); roland@525: }, roland@525: editor: { roland@525: xtype: 'messeinheit', roland@525: allowBlank: false raimund@491: } raimund@491: }, { raimund@491: header: 'Grenzwertüberschreitung', raimund@491: dataIndex: 'grenzwertueberschreitung', raimund@491: flex: 1, raimund@491: renderer: function(value) { raimund@491: if (value === true) { raimund@497: return 'Ja'; torsten@183: } raimund@497: return 'Nein'; roland@525: }, roland@525: editor: { roland@525: xtype: 'checkboxfield' torsten@183: } raimund@491: }]; torsten@183: this.callParent(arguments); roland@545: }, roland@545: listeners: { roland@545: selectionchange: function(model, selected, eOpts) { roland@545: /* roland@545: * Enable the 'details' button only when an item is selected roland@545: */ roland@545: if (selected.length > 0) { roland@545: this.down('button[action=open]').enable(); roland@545: } roland@545: } torsten@183: } torsten@183: });