view app/view/proben/List.js @ 241:4ca858026191

If the user selects a search query add call setupColumns method to dynamically add columns to the table as defined in the searach query.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 23 Jul 2013 11:31:47 +0200
parents f57b496b4caa
children c8c53f162a22
line wrap: on
line source
Ext.define('Lada.view.proben.List' ,{
    extend: 'Ext.grid.Panel',
    alias: 'widget.probenlist',
    store: 'Proben',
    viewConfig: {
        maxHeight: 350,
        emptyText: 'Keine Proben gefunden.',
        // minHeight and deferEmptyText are needed to be able to show the
        // emptyText message.
        minHeight: 35,
        deferEmptyText: false
    },
    availableColumns: [
            {header: 'Datenbasis',  dataIndex: 'datenbasisId', width: 70},
            {header: 'MPL',  dataIndex: 'mplId', width: 50},
            {header: 'UWB',  dataIndex: 'umwId', width: 50},
            {header: 'MMT',  dataIndex: 'messmethode'},
            {header: 'HPNR',  dataIndex: 'hauptprobenNr'},
            {header: 'NPNR',  dataIndex: 'nebenprobenNr'},
            {header: 'E.Gemeinde',  dataIndex: 'bezeichnung', flex: 1},
            {header: 'Ursprungsgemeinde',  dataIndex: 'kreis', flex: 1},
            {header: 'ProbeID', dataIndex: 'probeId'},
            {header: 'MST', dataIndex: 'mstId', width: 50}
    ],
    initComponent: function() {
        this.dockedItems = [
            {
                xtype: 'toolbar',
                dock: 'top',
                items: [
                    {
                        text: 'Hinzufügen',
                        icon: 'gfx/plus.gif',
                        action: 'add'
                    }
                ]
            }
        ];
        this.columns = [];
        this.callParent(arguments);
    },
    setupColumns: function(colnames) {
        var cols = []
        for (var i = colnames.length - 1; i >= 0; i--){
            col = colnames[i];
            for (var j = this.availableColumns.length - 1; j >= 0; j--){
                defaultCol = this.availableColumns[j];
                if (defaultCol.dataIndex === col) {
                    cols.push(this.availableColumns[j])
                };
            };
        };
        this.reconfigure(this.store, cols);
    }
});

http://lada.wald.intevation.org