dustin@975: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz dustin@975: * Software engineering by Intevation GmbH dustin@975: * dustin@975: * This file is Free Software under the GNU GPL (v>=3) dustin@975: * and comes with ABSOLUTELY NO WARRANTY! Check out dustin@975: * the documentation coming with IMIS-Labordaten-Application for details. dustin@975: */ dustin@975: dustin@975: /** dustin@975: * Grid to list MessprogrammKategorie Stammdaten dustin@975: */ dustin@975: Ext.define('Lada.view.grid.MessprogrammKategorie', { dustin@975: extend: 'Ext.grid.Panel', dustin@1011: alias: 'widget.messprogrammkategoriegrid', dustin@975: dustin@975: // minHeight and deferEmptyText are needed to be able to show the dustin@975: // emptyText message. dustin@975: minHeight: 110, dustin@975: viewConfig: { dustin@975: deferEmptyText: false dustin@975: }, dustin@975: dustin@975: warnings: null, dustin@975: errors: null, dustin@975: readOnly: true, dustin@975: allowDeselect: true, dustin@981: border: false, dustin@975: dustin@975: initComponent: function() { dustin@975: var i18n = Lada.getApplication().bundle; dustin@975: this.emptyText = i18n.getMsg('mk.emptyGrid'); dustin@975: raimund@1039: if (Ext.Array.contains(Lada.funktionen, 4)) { raimund@1039: this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { raimund@1039: clicksToMoveEditor: 1, raimund@1039: autoCancel: false, raimund@1060: errorSummary: false, raimund@1039: disabled: false, raimund@1039: pluginId: 'rowedit' raimund@1039: }); raimund@1039: this.plugins = [this.rowEditing]; raimund@1039: } dustin@982: dustin@975: // TODO: Which docked Items are required? dustin@975: this.dockedItems = [{ dustin@975: xtype: 'toolbar', dustin@975: dock: 'top', dustin@975: items: [{ dustin@975: xtype: 'tbtext', dustin@975: text: i18n.getMsg('mk.gridTitle') dustin@1003: }, dustin@1003: '->', dustin@1003: { dustin@1003: text: i18n.getMsg('mk.button.add'), dustin@1003: icon: 'resources/img/list-add.png', dustin@1003: action: 'add', dustin@1003: disabled: true // disabled on startup, will be enabled by setStore dustin@1003: }, { dustin@1003: text: i18n.getMsg('mk.button.delete'), dustin@1003: icon: 'resources/img/list-remove.png', dustin@1003: action: 'delete', dustin@1003: disabled: true // disabled on startup, will be enabled by controller if necessary dustin@975: }] dustin@975: }]; dustin@975: dustin@975: this.columns = [{ dustin@975: header: i18n.getMsg('netzbetreiberId'), dustin@975: dataIndex: 'netzbetreiberId', dustin@975: renderer: function(value) { dustin@975: var r = ''; dustin@975: if (!value || value === '') { dustin@975: r = 'Error'; dustin@975: } dustin@975: var store = Ext.data.StoreManager.get('netzbetreiber'); dustin@975: var record = store.getById(value); dustin@975: if (record) { dustin@975: r = record.get('netzbetreiber'); dustin@975: } dustin@975: return r; dustin@975: }, dustin@975: editor: { dustin@975: xtype: 'combobox', raimund@1075: store: Ext.data.StoreManager.get('netzbetreiberFiltered'), dustin@975: displayField: 'netzbetreiber', dustin@975: valueField: 'id', dustin@975: allowBlank: false dustin@975: } dustin@975: }, { dustin@975: header: i18n.getMsg('mplId'), dustin@975: dataIndex: 'mplId', dustin@975: editor: { dustin@1014: xtype: 'textfield', dustin@975: allowBlank: false dustin@975: } dustin@975: }, { dustin@975: header: i18n.getMsg('bezeichnung'), dustin@975: dataIndex: 'bezeichnung', dustin@975: editor: { dustin@1014: xtype: 'textfield', dustin@975: allowBlank: false dustin@975: } dustin@975: }, { dustin@975: header: i18n.getMsg('letzteAenderung'), raimund@1045: xtype: 'datecolumn', raimund@1045: format: 'd.m.Y H:i', dustin@975: dataIndex: 'letzteAenderung' dustin@975: }]; dustin@975: this.callParent(arguments); dustin@975: }, dustin@975: dustin@975: /** dustin@975: * This sets the Store of this Grid dustin@975: */ raimund@1039: setStore: function(store) { dustin@975: var i18n = Lada.getApplication().bundle; raimund@1039: if (Ext.Array.contains(Lada.funktionen, 4)) { raimund@1039: this.down('button[action=add]').enable(); raimund@1039: } dustin@975: dustin@1014: if (store) { dustin@1014: this.reconfigure(store); dustin@1014: dustin@1014: var ptbar = this.down('pagingtoolbar'); dustin@1014: if (ptbar) { dustin@1014: this.removeDocked(ptbar); dustin@1014: } dustin@1014: dustin@1014: this.addDocked([{ dustin@1014: xtype: 'pagingtoolbar', dustin@1014: dock: 'bottom', dustin@1014: store: store, dustin@1014: displayInfo: true dustin@1014: }]); dustin@1014: } dustin@975: } dustin@975: });