LCsvExport.vue 1.01 KB
Newer Older
Håvard Vika Røen's avatar
Håvard Vika Røen committed
1
2
3
4
5
6
7
<template>
  <div class="w-full flex mb-4">
    <div class="w-full flex mr-2">
      <l-info-box class="" :active="show">Right click a row to edit, delete or add a new record</l-info-box>
    </div>
    <div class="flex mr-2">
      <div class="flex w-full justify-end" v-show="show">
8
        <l-button type="success" :disabled="false" @click="onExport">Export to csv</l-button>
Håvard Vika Røen's avatar
Håvard Vika Røen committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
      </div>
    </div>
  </div>
</template>

<script>
import { LInput, LButton, LUpload } from "@/components/forms";
import LInfoBox from "@/components/LInfoBox";

export default {
  name: "LCsvExport",
  props: ["exportPlugin", "show", "filename"],
  components: {
    LInput,
    LButton,
    LUpload,
    LInfoBox
  },
  data() {
    return {
      file: {},
    };
  },
  methods: {
    onExport() {
      this.exportPlugin.downloadFile("csv", {
        filename: this.filename,
        columnHeaders: true, // default false, exports the column headers
        columnDelimiter: ";", // default ',', the data delimiter
      });
    },
  },
};
</script>