raimund@1076: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
raimund@1076:  * Software engineering by Intevation GmbH
raimund@1076:  *
raimund@1076:  * This file is Free Software under the GNU GPL (v>=3)
raimund@1076:  * and comes with ABSOLUTELY NO WARRANTY! Check out
raimund@1076:  * the documentation coming with IMIS-Labordaten-Application for details.
raimund@1076:  */
raimund@1076: 
raimund@1076: /**
raimund@1076:  * Grid to list the result of the Filter
raimund@1076:  */
raimund@1076: Ext.define('Lada.view.grid.MessungList', {
raimund@1076:     extend: 'Lada.view.widget.DynamicGrid',
raimund@1076:     alias: 'widget.messunglistgrid',
raimund@1076: 
raimund@1076:     initComponent: function() {
raimund@1076:         var i18n = Lada.getApplication().bundle;
raimund@1076:         this.emptyText = i18n.getMsg('messung.emptyGrid');
raimund@1076:         this.selModel = Ext.create('Ext.selection.CheckboxModel', {
raimund@1112:             checkOnly: true,
raimund@1112:             injectCheckbox: 1
raimund@1076:         });
raimund@1076: 
raimund@1076:         this.dockedItems = [{
raimund@1076:             xtype: 'toolbar',
raimund@1076:             dock: 'top',
raimund@1076:             items: [{
raimund@1076:                 xtype: 'tbtext',
raimund@1076:                 text: i18n.getMsg('messung.gridTitle')
raimund@1076:             },
raimund@1076:             '->',
raimund@1076:             {
raimund@1076:                 text: i18n.getMsg('probe.button.print'),
raimund@1076:                 icon: 'resources/img/printer.png',
raimund@1076:                 action: 'print',
raimund@1076:                 disabled: true //disabled on start, enabled by the controller
raimund@1076:             }, {
raimund@1076:                 text: i18n.getMsg('statusSetzen'),
raimund@1109:                 icon: 'resources/img/mail-mark-notjunk.png',
raimund@1082:                 action: 'setstatus',
raimund@1076:                 disabled: true //disabled on start, enabled by the controller
raimund@1076:             }]
raimund@1076:         }];
raimund@1076:         this.columns = [];
raimund@1076:         this.callParent(arguments);
raimund@1076:     },
raimund@1076: 
raimund@1076:     /**
raimund@1076:      * Setup columns of the Grid dynamically based on a list of given cols.
raimund@1076:      * The function is called from the {@link Lada.controller.Filter#search
raimund@1076:      * search event}
raimund@1076:      * The Images for the Read-Write Icon are defined in CSS
raimund@1076:      * This Method overrides setupColumns of the parents class,
raimund@1076:      * becaus the delete colum is required.
raimund@1076:      */
raimund@1076:     setupColumns: function(cols) {
raimund@1076:         var caf = this.generateColumnsAndFields(cols);
raimund@1076:         var columns = caf[0];
raimund@1076:         var fields = caf[1];
raimund@1076:         var i18n = Lada.getApplication().bundle;
raimund@1076: 
raimund@1076:         this.store.model.setFields(fields);
raimund@1076:         this.reconfigure(this.store, columns);
raimund@1076:     }
raimund@1076: });