Our blazing fast Grid component built with pure JavaScript


Post by Sapling »

Hey,

is it possible to export as excel file within the vue integration?

The documentation is rly confusing me ...

This is my code (i'm just using the trial atm):

<template>
    <div>
        <button @click="download">Download</button>
        <grid style="height: 500px"
              ref="grid"
              :columns="columns"
              :data="data"
              :searchFeature=true
              :features="features"
        ></grid>
    </div>
</template>
<script>
    import zipcelx from 'zipcelx';
    import Grid from 'bryntum-vue-grid-shared/src/Grid';
    import { TableExporter } from 'bryntum-grid';

export default {
    name: 'datatable',

    components: {
        Grid,
    },

    methods: {
        download() {
            const exporter = new TableExporter(this.features.excelExporter.exporterConfig);
            exporter.export()
        },
    },

    data() {
        return {
            features: {
                filter: true,
                excelExporter: {
                    zipcelx,
                    exporterConfig: {
                        target: this.$refs.grid,
                        columns: [
                            { text: 'ID', field: 'id', width: 90 },
                            { text: 'Erstellt am', field: 'created_at', width: 90 },
                            { text: 'Punkte', field: 'points', width: 90 },
                            { text: 'Land', field: 'country', width: 90 },
                        ],
                    }
                },
            },

            columns: [
                {
                    field: 'id',
                    text: 'Id',
                    flex: 1,
                },
                {
                    field: 'created_at',
                    text: 'Erstellt am',
                    flex: 1,
                },
                {
                    field: 'points',
                    text: 'Punkte',
                    flex: 1,
                },
                {
                    field: 'country',
                    text: 'Land',
                    flex: 1,
                },
                {
                    field: 'dealer_number',
                    text: 'Hdl. Nr',
                    flex: 1,
                },
                {
                    field: 'dealer',
                    text: 'Händler',
                    flex: 1,
                },
                {
                    field: 'seller',
                    text: 'Verkäufer',
                    flex: 1,
                },
                {
                    field: 'mail',
                    text: 'E-Mail',
                    flex: 1,
                },
                {
                    field: 'attributes',
                    text: 'Indiv. Attribute',
                    flex: 1,
                },
                {
                    field: 'ab_number',
                    text: 'AB Nummer',
                    flex: 1,
                },
                {
                    field: 'vin',
                    text: 'VIN',
                    flex: 1,
                },
                {
                    field: 'type',
                    text: 'Typ',
                    flex: 1,
                },
                {
                    field: 'brand',
                    text: 'Marke',
                    flex: 1,
                },
                {
                    field: 'mnumber',
                    text: 'Modellklasse',
                    flex: 1,
                },
                {
                    field: 'm',
                    text: 'Modell',
                    flex: 1,
                },
                {
                    field: 'saison',
                    text: 'Saison',
                    flex: 1,
                },
                {
                    field: 'ad',
                    text: 'Auftragsdatum (KT)',
                    flex: 1,
                },
                {
                    field: 'handout',
                    text: 'geplanter Übergabetermin an Kunden',
                    flex: 1,
                },
                {
                    field: 'com',
                    text: 'Kommission / Beschreibung',
                    flex: 1,
                },
                {
                    field: 'z',
                    text: 'Zahlungsart',
                    flex: 1,
                },
                {
                    field: 'ka',
                    text: 'Kundenart',
                    flex: 1,
                },
                {
                    field: 'reason',
                    text: 'Grund',
                    flex: 1,
                },
            ],
        }
    },

    computed: {
        data() {
            let _data = [];

            let i;
            for (i = 1; i <= 3216; i++) {
                _data.push(
                    {
                        id: i,
                        created_at: '03.08.20',
                        points: 450,
                        country: 'DE',
                        dealer_number: 10000,
                        dealer: 'a',
                        seller: 'b',
                        mail: 'a@a.de',
                        attributes: 'Attribute 1, Attribute 2',
                        ab_number: '1234567',
                        vin: 'ABCDEFG123456789',
                        type: 'RM',
                        brand: 'Brand',
                        mnumber: '[tbc]',
                        m: 'Modell',
                        saison: '2010',
                        ad: '28.10.19',
                        handout: '07.08.20',
                        com: '',
                        z: 'Bar',
                        ka: 'Unternehmen',
                        reason: '',
                    },
                );
            }

            return _data;
        }
    },
}
</script>

Edit:
Btw. this i the error which occurs:

imgpsh_mobile_save.jpg
imgpsh_mobile_save.jpg (32.22 KiB) Viewed 1048 times

Thank you.


Post by saki »

We have made Vue example of exporting grid to Excel. It will be available in the next release but I attach the zip file so that you can test it earlier.

Unzip it beside the other Vue examples and run npm i and npm run serve.

Attachments
export-excel.zip
(899.92 KiB) Downloaded 105 times

Post by Sapling »

saki wrote: Thu Nov 26, 2020 7:43 pm

We have made Vue example of exporting grid to Excel. It will be available in the next release but I attach the zip file so that you can test it earlier.

Unzip it beside the other Vue examples and run npm i and npm run serve.

Hey, your example is not working for me... Again, is the excel export also working with the trial version? ...
have just added the trial deps and fired the npm i and npm run serve. got exactly the same error. exporter is not defined.

edit: not exactly the same like before but i already had the same error once.

imgpsh_mobile_save-1.jpg
imgpsh_mobile_save-1.jpg (220.77 KiB) Viewed 1030 times

Post by saki »

There is one more thing in the upcoming release that needs to be updated and that is the Grid wrapper. Unzip the attached file please and replace examples/vue/javascript/_shared/src/Grid.vue with the unzipped Grid.vue. Reinstall and re-run and it'll work.

Attachments
Grid.vue.zip
(1.85 KiB) Downloaded 122 times

Post by Sapling »

Still the same issue ... this vue file is also not containing the following option: "excelExporterFeature"


Post by saki »

I have re-downloaded the above file and I can see the line there. Anyway, what is missing from the existing wrapper is line:

excelExporterFeature       : { type : [ Object, Boolean ], default : undefined },

Add it please to the wrapper you use, rebuild your app and it will work


Post Reply