Hi,
When exporting to excel, I'd like the exported file to have an additional column (blank) that doesn't exist on the data grid. E.g: I have columns called 'pn', 'description' and 'quantity'. I'd like to add a column called 'checked' between 'description' and 'quantity' so that someone can print the excel file and tick it.
|
<template>
<div id="app">
<ejs-grid
id="Grid"
ref="grid"
:toolbar="toolbarOptions"
:dataSource="data"
:allowPaging="true"
:allowExcelExport="true"
:toolbarClick="toolbarClick"
>
<e-columns>
<e-column
field="OrderID"
headerText="Pn"
width="180"
isPrimaryKey="true"
headerTextAlign="center"
></e-column>
<e-column
field="CustomerID"
headerText="Description"
width="180"
headerTextAlign="center"
></e-column>
<e-column headerText="checked" :visible="false" width="180"></e-column>
<e-column
field="EmployeeID"
headerText="Quantity"
width="180"
headerTextAlign="center"
></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import {
GridPlugin,
Freeze,
Edit,
Toolbar,
ExcelExport,
Page,
Filter,
ColumnChooser,
ContextMenu,
} from "@syncfusion/ej2-vue-grids";
import { gridData } from "./data";
Vue.use(GridPlugin);
export default {
data() {
return {
data: gridData,
toolbarOptions: ["ExcelExport"],
};
},
methods: {
toolbarClick: function (args) {
if (args.item.id === "Grid_excelexport") {
// 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let excelExportProperties = {
includeHiddenColumn: true,
};
this.$refs.grid.excelExport(excelExportProperties);
}
},
},
provide: {
grid: [
ContextMenu,
Freeze,
Edit,
Toolbar,
ExcelExport,
Page,
Filter,
ColumnChooser,
],
},
};
</script>
<style>
</style>
|