| 2020-12-23T05:00:00.000Z |
|
<template>
<div id="app">
<ejs-grid
id="Grid"
ref="grid"
height="400"
:allowExcelExport="true"
:toolbarClick="toolbarClick"
></ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import {GridPlugin, Toolbar, ExcelExport, Page, } from "@syncfusion/ej2-vue-grids";
import { DataUtil } from "@syncfusion/ej2-data";
import { data } from "./datasource";
Vue.use(GridPlugin);
export default {
data() {
return {
data: DataUtil.parse.parseJson(JSON.stringify(data)),
toolbarOptions: ["ExcelExport"],
columns: [
. . . . . . . .
. . . . . . . .
],
};
},
provide: {
grid: [ExcelExport, Page, Toolbar],
},
methods: {
toolbarClick: function (args) {
if (args.item.id === "Grid_excelexport") {
// 'Grid_excelexport' -> Grid component id + _ + toolbar item name
this.$refs.grid.excelExport();
}
},
},
};
</script>
|