Exporting hierarchy grid in Vue Grid component

16 Mar 20234 minutes to read

The grid have an option to export the hierarchy grid to pdf document. By default, grid will exports the master grid with expanded child grids alone. you can change the exporting option by using the PdfExportProperties.hierarchyExportMode property. The available options are,

Mode Behavior
Expanded Exports the master grid with expanded child grids.
All Exports the master grid with all the child grids.
None Exports the master grid alone.
    <div id="app">
        <ejs-grid ref='grid' id='Grid' :dataSource='parentData' :childGrid='childGrid' :toolbar='["PdfExport"]' :toolbarClick='toolbarClick' :allowPdfExport='true'>
                    <e-column field='EmployeeID' headerText='Employee ID' textAlign='Right' width=120></e-column>
                    <e-column field='FirstName' headerText='FirstName' width=150></e-column>
                    <e-column field='LastName' headerText='Last Name' width=150></e-column>
                    <e-column field='City' headerText='City' width=150></e-column>
import Vue from "vue";
import { GridPlugin, DetailRow, Toolbar, PdfExport, PdfExportProperties } from "@syncfusion/ej2-vue-grids";
import { data, employeeData } from './datasource.js';
import { extend } from '@syncfusion/ej2-base';


export default {
  data() {
    return {
      parentData: employeeData,
      childGrid: {
        dataSource: data,
        queryString: 'EmployeeID',
        columns: [
            { field: 'OrderID', headerText: 'Order ID', textAlign: 'Right', width: 120 },
            { field: 'CustomerID', headerText: 'Customer ID', width: 150 },
            { field: 'ShipCity', headerText: 'Ship City', width: 150 },
            { field: 'ShipName', headerText: 'Ship Name', width: 150 }
  methods: {
      toolbarClick: function( args) {
        if (args['item'].id === 'Grid_pdfexport') {
            let exportProperties = {
                hierarchyExportMode: "Expanded"
  provide: {
      grid: [DetailRow, Toolbar, PdfExport]
 @import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";