dustin@764: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz dustin@764: * Software engineering by Intevation GmbH dustin@764: * dustin@764: * This file is Free Software under the GNU GPL (v>=3) dustin@764: * and comes with ABSOLUTELY NO WARRANTY! Check out dustin@764: * the documentation coming with IMIS-Labordaten-Application for details. dustin@764: */ dustin@764: dustin@764: /* dustin@764: * Grid to list Nuklide dustin@764: */ dustin@764: Ext.define('Lada.view.grid.Nuklide', { dustin@764: extend: 'Ext.grid.Panel', dustin@764: alias: 'widget.nuklidegrid', dustin@764: dustin@764: selType: 'checkboxmodel', dustin@764: selModel: { dustin@764: checkOnly: false, dustin@764: injectCheckbox: 0 dustin@764: }, dustin@764: requires: [ dustin@764: 'Lada.view.widget.Messgroesse' dustin@764: ], dustin@764: dustin@764: maxHeight: 350, dustin@764: minHeight: 110, dustin@764: viewConfig: { dustin@764: deferEmptyText: false dustin@764: }, dustin@764: margin: '0, 5, 5, 5', dustin@764: dustin@764: recordId: null, dustin@764: dustin@764: initComponent: function() { dustin@764: var i18n = Lada.getApplication().bundle; dustin@764: this.emptyText = i18n.getMsg('emptytext.nuklidgrid'); dustin@764: dustin@764: this.dockedItems = [{ dustin@764: xtype: 'toolbar', dustin@764: dock: 'bottom', dustin@764: items: ['->', { dustin@764: text: i18n.getMsg('save'), dustin@764: qtip: i18n.getMsg('save.qtip'), dustin@764: icon: 'resources/img/dialog-ok-apply.png', dustin@764: action: 'save', dustin@764: disabled: true dustin@764: }, { dustin@764: text: i18n.getMsg('discard'), dustin@764: qtip: i18n.getMsg('discard.qtip'), dustin@764: icon: 'resources/img/dialog-cancel.png', dustin@764: action: 'discard', dustin@764: disabled: true dustin@764: }] dustin@764: }]; dustin@764: this.columns = [{ dustin@764: header: i18n.getMsg('nuklid'), dustin@764: dataIndex: 'id', dustin@764: flex: 1, dustin@764: renderer: function(value) { dustin@764: if (!value || value === '') { dustin@764: return ''; dustin@764: } dustin@764: var store = Ext.data.StoreManager.get('messgroessen'); dustin@764: if (!store) { dustin@764: store = Ext.create('Lada.store.Messgroessen'); dustin@764: } dustin@764: return store.findRecord('id', value, 0, false, false, true).get('messgroesse'); dustin@764: } dustin@764: }]; dustin@764: this.initData(); dustin@764: this.callParent(arguments); dustin@764: }, dustin@764: initData: function() { dustin@764: if (this.store) { dustin@764: this.store.removeAll(); dustin@764: } dustin@764: }, dustin@764: setData: function(store) { dustin@764: this.setLoading(true); dustin@764: this.reconfigure(store); dustin@764: this.setLoading(false); dustin@764: }, dustin@764: setReadOnly: function(b) { dustin@764: if (b == true){ dustin@764: //Readonly dustin@764: if (this.getPlugin('rowedit')){ dustin@764: this.getPlugin('rowedit').disable(); dustin@764: } dustin@764: this.down('button[action=discard]').disable(); dustin@764: this.down('button[action=save]').disable(); dustin@764: }else{ dustin@764: //Writable dustin@764: if (this.getPlugin('rowedit')){ dustin@764: this.getPlugin('rowedit').enable(); dustin@764: } dustin@764: this.down('button[action=discard]').enable(); dustin@764: this.down('button[action=save]').enable(); dustin@764: } dustin@764: } dustin@764: });