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 the result of the Filter dustin@975: */ dustin@975: Ext.define('Lada.view.grid.ProbeList', { dustin@975: extend: 'Lada.view.widget.DynamicGrid', dustin@975: alias: 'widget.probelistgrid', dustin@975: tom@1189: requires: [ tom@1189: 'Lada.view.window.DeleteProbe', tom@1189: 'Lada.view.window.ProbeCreate' tom@1189: ], dustin@975: dustin@975: initComponent: function() { dustin@975: var i18n = Lada.getApplication().bundle; dustin@975: this.emptyText = i18n.getMsg('probe.emptyGrid'); ehuber@1161: this.selModel = Ext.create('Ext.selection.CheckboxModel', { ehuber@1161: checkOnly: true, ehuber@1161: injectCheckbox: 1 ehuber@1161: }); dustin@975: this.dockedItems = [{ dustin@975: xtype: 'toolbar', dustin@975: dock: 'top', dustin@975: items: [{ dustin@975: xtype: 'tbtext', dustin@975: text: i18n.getMsg('probe.gridTitle') dustin@975: }, dustin@975: '->', dustin@975: { dustin@975: text: i18n.getMsg('probe.button.create'), dustin@975: icon: 'resources/img/list-add.png', dustin@975: action: 'addProbe', dustin@975: disabled: false dustin@975: }, { dustin@975: text: i18n.getMsg('probe.button.import'), dustin@975: icon: 'resources/img/svn-commit.png', dustin@975: action: 'import', dustin@975: disabled: false dustin@975: }, { dustin@975: text: i18n.getMsg('probe.button.export'), dustin@975: icon: 'resources/img/svn-update.png', dustin@977: action: 'export', dustin@977: disabled: true //disabled on start, enabled by the controller dustin@975: }, { dustin@1244: text: i18n.getMsg('probe.button.printSheet'), dustin@1244: icon: 'resources/img/printer.png', dustin@1244: action: 'printSheet', dustin@1244: disabled: true //disabled on start, enabled by the controller dustin@1244: }, { dustin@975: text: i18n.getMsg('probe.button.print'), dustin@975: icon: 'resources/img/printer.png', dustin@1244: action: 'printExtract', dustin@977: disabled: true //disabled on start, enabled by the controller dustin@975: }] dustin@975: }]; dustin@975: this.columns = []; dustin@975: this.callParent(arguments); dustin@975: }, dustin@975: dustin@975: /** dustin@975: * Setup columns of the Grid dynamically based on a list of given cols. dustin@975: * The function is called from the {@link Lada.controller.Filter#search dustin@975: * search event} dustin@975: * The Images for the Read-Write Icon are defined in CSS dustin@975: * This Method overrides setupColumns of the parents class, dustin@975: * becaus the delete colum is required. dustin@975: */ dustin@975: setupColumns: function(cols) { dustin@975: var caf = this.generateColumnsAndFields(cols); dustin@975: var columns = caf[0]; dustin@975: var fields = caf[1]; dustin@975: var i18n = Lada.getApplication().bundle; dustin@975: dustin@975: columns.push({ dustin@975: xtype: 'actioncolumn', dustin@975: text: i18n.getMsg('action'), dustin@975: sortable: false, dustin@975: width: 30, dustin@975: items: [{ dustin@975: icon: 'resources/img/edit-delete.png', dustin@975: tooltip: i18n.getMsg('delete'), dustin@975: isDisabled: function(grid, rowIndex, colIndex) { dustin@975: var rec = grid.getStore().getAt(rowIndex); dustin@975: if ( rec.get('readonly') || !rec.get('owner')) { dustin@975: return true; dustin@975: } dustin@975: return false; dustin@975: }, dustin@975: handler: function(grid, rowIndex, colIndex){ dustin@975: var rec = grid.getStore().getAt(rowIndex); dustin@975: dustin@975: var winname = 'Lada.view.window.DeleteProbe'; dustin@975: var win = Ext.create(winname, { dustin@975: record: rec, dustin@975: parentWindow: this dustin@975: }); dustin@975: win.show(); dustin@975: win.initData(); dustin@975: } dustin@975: }] dustin@975: }); dustin@975: this.store.model.setFields(fields); dustin@975: this.reconfigure(this.store, columns); dustin@975: } dustin@975: }); dustin@975: