|
| 1 | +<template> |
| 2 | + <ejs-treegrid :dataSource="data" childMapping="Children" :allowPaging="true" |
| 3 | + :treeColumnIndex="0" :height='450' :rowHeight="83" :rowTemplate="'customTemplate'"> |
| 4 | + <e-columns> |
| 5 | + <e-column field='EmpID' headerText='Employee ID' width='180'></e-column> |
| 6 | + <e-column field='Name' headerText='Employee Name'></e-column> |
| 7 | + <e-column headerText='Employee Details' width='350'></e-column> |
| 8 | + <e-column field='DOB' headerText='DOB'></e-column> |
| 9 | + </e-columns> |
| 10 | + <template v-slot:customTemplate="{data}"> |
| 11 | + <tr> |
| 12 | + <td class="border" style="padding-left: 18px;"> |
| 13 | + <span>{{data.EmpID}}</span> |
| 14 | + </td> |
| 15 | + <td class="border" style="padding: 10px 0 0 20px;"> |
| 16 | + <div style="font-size: 14px;"> |
| 17 | + {{data.Name}} |
| 18 | + <p style="font-size: 9px;">{{data.Designation}}</p> |
| 19 | + </div> |
| 20 | + </td> |
| 21 | + <td class="border"> |
| 22 | + <div> |
| 23 | + <div style="position: relative;display:inline-block"> |
| 24 | + <img :src="'https://ej2.syncfusion.com/vue/demos/source/tree-grid/images/'+ data.FullName + '.png'" |
| 25 | + alt="data.FullName"/> |
| 26 | + </div> |
| 27 | + <div style="display: inline-block;"> |
| 28 | + <div style="padding: 5px;">{{data.Address}}</div> |
| 29 | + <div style="padding: 5px;">{{data.Country}}</div> |
| 30 | + <div style="padding: 5px;font-size: 12px;">{{data.Contact}}</div> |
| 31 | + </div> |
| 32 | + </div> |
| 33 | + </td> |
| 34 | + <td class="border" style="padding-left: 20px;"> |
| 35 | + <span>{{format(data.DOB)}}</span> |
| 36 | + </td> |
| 37 | + </tr> |
| 38 | + </template> |
| 39 | + </ejs-treegrid> |
| 40 | +</template> |
| 41 | +<script> |
| 42 | +import { TreeGridComponent, ColumnsDirective, ColumnDirective, Page } from "@syncfusion/ej2-vue-treegrid"; |
| 43 | +import {employeeData} from './data.js'; |
| 44 | +import {Internationalization} from '@syncfusion/ej2-base'; |
| 45 | +let object = new Internationalization(); |
| 46 | +export default{ |
| 47 | + name: 'App', |
| 48 | + components: { |
| 49 | + 'ejs-treegrid': TreeGridComponent, |
| 50 | + 'e-columns': ColumnsDirective, |
| 51 | + 'e-column': ColumnDirective |
| 52 | + }, |
| 53 | + data: () => { |
| 54 | + return { |
| 55 | + data: employeeData |
| 56 | + } |
| 57 | + }, |
| 58 | + methods:{ |
| 59 | + format(date){ |
| 60 | + return object.formatDate(date,{skeleton:'yMd', type:'date'}) |
| 61 | + } |
| 62 | + }, |
| 63 | + provide:{ |
| 64 | + treegrid: [Page] |
| 65 | + } |
| 66 | +} |
| 67 | +</script> |
| 68 | + |
| 69 | +<style> |
| 70 | + @import "../node_modules/@syncfusion/ej2-base/styles/material.css"; |
| 71 | + @import "../node_modules/@syncfusion/ej2-buttons/styles/material.css"; |
| 72 | + @import "../node_modules/@syncfusion/ej2-calendars/styles/material.css"; |
| 73 | + @import "../node_modules/@syncfusion/ej2-dropdowns/styles/material.css"; |
| 74 | + @import "../node_modules/@syncfusion/ej2-inputs/styles/material.css"; |
| 75 | + @import "../node_modules/@syncfusion/ej2-navigations/styles/material.css"; |
| 76 | + @import "../node_modules/@syncfusion/ej2-popups/styles/material.css"; |
| 77 | + @import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css"; |
| 78 | + @import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css"; |
| 79 | + @import "../node_modules/@syncfusion/ej2-vue-treegrid/styles/material.css"; |
| 80 | +
|
| 81 | + #app{ |
| 82 | + max-width: 80%; |
| 83 | + } |
| 84 | +
|
| 85 | + .border{ |
| 86 | + border: solid #e0e0e0; |
| 87 | + border-width: 1px 0 0 0; |
| 88 | + } |
| 89 | +</style> |
0 commit comments