|
| 1 | +<template> |
| 2 | + <ejs-treegrid ref="treegrid" :dataSource="data" childMapping="subtasks" |
| 3 | + :treeColumnIndex="1" :height='450' :allowPaging="true" |
| 4 | + :allowPdfExport="true" :toolbar="toolbarOptions" :toolbarClick="toolbarBtnClick"> |
| 5 | + <e-columns> |
| 6 | + <e-column field='ID' headerText='S.No' width='90' textAlign='Right'></e-column> |
| 7 | + <e-column field='Name' headerText='ShipMent Name' width='220'></e-column> |
| 8 | + <e-column field='category' headerText='Category' width='220'></e-column> |
| 9 | + <e-column field='unitPrice' headerText='Unit Price($)' format='c2' width='120' textAlign='Right'></e-column> |
| 10 | + <e-column field='price' headerText='Price($)' width='100' format='c' textAlign='Right'></e-column> |
| 11 | + </e-columns> |
| 12 | + </ejs-treegrid> |
| 13 | +</template> |
| 14 | +<script> |
| 15 | +import { TreeGridComponent, ColumnsDirective, ColumnDirective, Page, PdfExport, Toolbar } from "@syncfusion/ej2-vue-treegrid"; |
| 16 | +import {summaryData} from './data.js'; |
| 17 | +
|
| 18 | +export default{ |
| 19 | + name: 'App', |
| 20 | + components: { |
| 21 | + 'ejs-treegrid': TreeGridComponent, |
| 22 | + 'e-columns': ColumnsDirective, |
| 23 | + 'e-column': ColumnDirective |
| 24 | + }, |
| 25 | + data: () => { |
| 26 | + return { |
| 27 | + data: summaryData, |
| 28 | + toolbarOptions: ['PdfExport'] |
| 29 | + } |
| 30 | + }, |
| 31 | + methods:{ |
| 32 | + toolbarBtnClick:function(args){ |
| 33 | + var treegridObj = this.$refs.treegrid.ej2Instances; |
| 34 | + if(args['item'].text ==='PDF Export'){ |
| 35 | + treegridObj.pdfExport({ |
| 36 | + fileName: "SummaryData.pdf", |
| 37 | + theme:{ |
| 38 | + header:{ |
| 39 | + fontColor: "#64FA50", |
| 40 | + fontName: "Calibri", |
| 41 | + fontSize: 10, |
| 42 | + bold: true |
| 43 | + }, |
| 44 | + record:{ |
| 45 | + fontSize: 8, |
| 46 | + fontName: "Calibri", |
| 47 | + fontColor: "#0000FF" |
| 48 | + } |
| 49 | + }, |
| 50 | + header:{ |
| 51 | + fromTop: 0, |
| 52 | + height: 130, |
| 53 | + contents: [ |
| 54 | + { |
| 55 | + type: "Text", |
| 56 | + value: "Shipment Details", |
| 57 | + position: {x:0, y:50}, |
| 58 | + style:{fontSize:20} |
| 59 | + } |
| 60 | + ] |
| 61 | + }, |
| 62 | + footer:{ |
| 63 | + fromBottom: 130, |
| 64 | + height: 130, |
| 65 | + contents:[ |
| 66 | + { |
| 67 | + type: 'Line', |
| 68 | + style: {penColor:"#000080", penSize:2, dashStyle:"Solid"}, |
| 69 | + points: { x1: 0, y1: 4, x2: 685, y2: 4} |
| 70 | + } |
| 71 | + ] |
| 72 | + } |
| 73 | + }); |
| 74 | + } |
| 75 | + } |
| 76 | + }, |
| 77 | + provide:{ |
| 78 | + treegrid: [Page, PdfExport, Toolbar] |
| 79 | + } |
| 80 | +} |
| 81 | +</script> |
| 82 | + |
| 83 | +<style> |
| 84 | + @import "../node_modules/@syncfusion/ej2-base/styles/material.css"; |
| 85 | + @import "../node_modules/@syncfusion/ej2-buttons/styles/material.css"; |
| 86 | + @import "../node_modules/@syncfusion/ej2-calendars/styles/material.css"; |
| 87 | + @import "../node_modules/@syncfusion/ej2-dropdowns/styles/material.css"; |
| 88 | + @import "../node_modules/@syncfusion/ej2-inputs/styles/material.css"; |
| 89 | + @import "../node_modules/@syncfusion/ej2-navigations/styles/material.css"; |
| 90 | + @import "../node_modules/@syncfusion/ej2-popups/styles/material.css"; |
| 91 | + @import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css"; |
| 92 | + @import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css"; |
| 93 | + @import "../node_modules/@syncfusion/ej2-vue-treegrid/styles/material.css"; |
| 94 | +</style> |
0 commit comments