torsten@348: /* torsten@348: * Grid to list Proben torsten@348: */ torsten@4: Ext.define('Lada.view.proben.List' ,{ torsten@4: extend: 'Ext.grid.Panel', torsten@4: alias: 'widget.probenlist', torsten@13: store: 'Proben', torsten@37: viewConfig: { torsten@37: maxHeight: 350, torsten@37: emptyText: 'Keine Proben gefunden.', torsten@37: // minHeight and deferEmptyText are needed to be able to show the torsten@37: // emptyText message. torsten@37: minHeight: 35, torsten@37: deferEmptyText: false torsten@37: }, torsten@237: availableColumns: [ torsten@237: {header: 'Datenbasis', dataIndex: 'datenbasisId', width: 70}, torsten@237: {header: 'MPL', dataIndex: 'mplId', width: 50}, torsten@237: {header: 'UWB', dataIndex: 'umwId', width: 50}, torsten@237: {header: 'MMT', dataIndex: 'messmethode'}, torsten@237: {header: 'HPNR', dataIndex: 'hauptprobenNr'}, torsten@237: {header: 'NPNR', dataIndex: 'nebenprobenNr'}, torsten@237: {header: 'E.Gemeinde', dataIndex: 'bezeichnung', flex: 1}, torsten@237: {header: 'Ursprungsgemeinde', dataIndex: 'kreis', flex: 1}, torsten@237: {header: 'ProbeID', dataIndex: 'probeId'}, torsten@237: {header: 'MST', dataIndex: 'mstId', width: 50} torsten@237: ], torsten@4: initComponent: function() { torsten@63: this.dockedItems = [ torsten@63: { torsten@63: xtype: 'toolbar', torsten@63: dock: 'top', torsten@63: items: [ torsten@63: { torsten@63: text: 'Hinzufügen', torsten@63: icon: 'gfx/plus.gif', torsten@63: action: 'add' torsten@357: }, torsten@357: { torsten@357: text: 'Import', torsten@357: icon: 'gfx/plus.gif', torsten@357: action: 'import' torsten@63: } torsten@63: ] torsten@63: } torsten@63: ]; torsten@238: this.columns = []; torsten@4: this.callParent(arguments); torsten@239: }, torsten@348: /** torsten@348: * Setup columns of the Grid dynamically based on a list of given cols. torsten@353: * The function is called from the {@link Lada.controller.Sql#selectSql torsten@348: * select sql event} torsten@348: * @parameter {Array} List of cols to show in the Grid. torsten@348: */ torsten@249: setupColumns: function(cols) { torsten@364: var rcols = []; torsten@258: rcols.push({header: 'RW', dataIndex: 'readonly', width: 30, renderer: render_readonly}); torsten@249: for (var i = cols.length - 1; i >= 0; i--){ torsten@249: rcols.push(cols[i]); torsten@364: } torsten@249: this.reconfigure(this.store, rcols); torsten@4: } torsten@4: }); torsten@258: torsten@348: /** torsten@348: * Helper function to render a readonly symbol per row in the grid torsten@348: * @param {Boolean} flag if the symbol is a readonly symbol. torsten@348: */ torsten@258: function render_readonly (value) { torsten@258: if (value) { torsten@363: return ''; torsten@258: } else { torsten@363: return ''; torsten@258: } torsten@258: }