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@351: /* torsten@351: * Grid to list Probenzusatzwerte torsten@351: */ raimund@497: Ext.define('Lada.view.zusatzwerte.List', { torsten@106: extend: 'Ext.grid.Panel', torsten@106: alias: 'widget.zusatzwertelist', raimund@491: torsten@106: store: 'Zusatzwerte', torsten@106: viewConfig: { torsten@106: maxHeight: 350, torsten@106: emptyText: 'Keine Zusatzwerte gefunden.', torsten@106: // minHeight and deferEmptyText are needed to be able to show the torsten@106: // emptyText message. raimund@530: minHeight: 65, torsten@106: deferEmptyText: false torsten@106: }, raimund@491: torsten@125: probeId: null, raimund@491: torsten@106: initComponent: function() { roland@537: var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { roland@537: clicksToMoveEditor: 1, roland@537: autoCancel: false roland@537: }); roland@537: this.plugins = [rowEditing]; 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: }, { 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: 'PZW-ID', roland@537: dataIndex: 'id', roland@537: editor: { roland@537: xtype: 'numberfield', roland@537: allowBlank: false roland@537: } raimund@491: }, { raimund@491: header: 'PZW-Größe', raimund@491: dataIndex: 'pzsId', raimund@491: renderer: function(value) { raimund@496: var store = Ext.data.StoreManager.get('staProbenzusaetze'); raimund@491: var record = store.getById(value); raimund@491: return record.get('beschreibung'); torsten@123: }, roland@537: flex: 1, roland@537: editor: { roland@537: xtype: 'probenzusatzwert' roland@537: } raimund@491: }, { raimund@491: header: 'Messwert', raimund@491: dataIndex: 'id', raimund@491: renderer: function(value) { raimund@491: var store = Ext.getStore('Zusatzwerte'); raimund@491: var record = store.getById(value); raimund@491: var messwert = record.get('messwertPzs'); raimund@491: var nwg = record.get('nwgZuMesswert'); raimund@497: if (messwert < nwg) { raimund@497: return '<' + messwert; torsten@123: } raimund@497: return messwert; torsten@123: } raimund@491: }, { raimund@491: header: 'rel. Unsich.[%]', roland@537: dataIndex: 'messfehler', roland@537: editor: { roland@537: allowBlank: false roland@537: } raimund@491: }, { raimund@491: header: 'Maßeinheit', raimund@491: dataIndex: 'pzsId', raimund@491: renderer: function(value) { raimund@496: var zstore = Ext.data.StoreManager.get('staProbenzusaetze'); raimund@496: var mstore = Ext.data.StoreManager.get('staMesseinheiten'); raimund@491: var mehId = zstore.getById(value).get('mehId'); raimund@491: var record = mstore.findRecord('id', mehId); raimund@491: return record.get('einheit'); roland@537: }/*, roland@537: editor: { roland@537: xtype: 'messeinheit', roland@537: allowBlank: false roland@537: }*/ raimund@491: }]; torsten@106: 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@106: } torsten@106: });