|
| 1 | +<template> |
| 2 | + <ejs-button :onclick="btnClick" cssClass="e-btn">Selection API</ejs-button> |
| 3 | + <ejs-treegrid :dataSource="data" ref="treegridObj" |
| 4 | + childMapping="subtasks" |
| 5 | + :treeColumnIndex="2" |
| 6 | + :selectionSettings="selectionOptions" |
| 7 | + :selectedRowIndex="2" |
| 8 | + :height='400' |
| 9 | + :allowPaging='true' |
| 10 | + :pageSettings='pageSettings'> |
| 11 | + <e-columns> |
| 12 | + <e-column type="Checkbox" width="50"></e-column> |
| 13 | + <e-column field='taskID' headerText='Task ID' width='80' textAlign='Right'></e-column> |
| 14 | + <e-column field='taskName' headerText='Task Name' width='190'></e-column> |
| 15 | + <e-column field='startDate' headerText='Start Date' width='100' format="yMd" textAlign='Right'></e-column> |
| 16 | + <e-column field='duration' headerText='Duration' width='90' textAlign='Right'></e-column> |
| 17 | + <e-column field='progress' headerText='Progress' width='90' textAlign='Right'></e-column> |
| 18 | + </e-columns> |
| 19 | + </ejs-treegrid> |
| 20 | +</template> |
| 21 | + |
| 22 | +<script> |
| 23 | +import { TreeGridComponent, ColumnsDirective, ColumnDirective, Page} from "@syncfusion/ej2-vue-treegrid"; |
| 24 | +import { ButtonComponent} from '@syncfusion/ej2-vue-buttons'; |
| 25 | +import {sampleData} from './data.js'; |
| 26 | +
|
| 27 | +export default{ |
| 28 | + name: 'App', |
| 29 | + components: { |
| 30 | + 'ejs-treegrid': TreeGridComponent, |
| 31 | + 'e-columns': ColumnsDirective, |
| 32 | + 'e-column': ColumnDirective, |
| 33 | + 'ejs-button': ButtonComponent |
| 34 | + }, |
| 35 | + data: () => { |
| 36 | + return { |
| 37 | + data: sampleData, |
| 38 | + // mode: "Cell", cellSelectionMode: "Box" |
| 39 | + selectionOptions: {type: "Multiple", checkboxOnly: false, checkboxMode: "ResetOnRowClick", enableToggle: false}, |
| 40 | + pageSettings: { pageSize: 12 } |
| 41 | + } |
| 42 | + }, |
| 43 | + methods: { |
| 44 | + btnClick: function(){ |
| 45 | + let treegrid = this.$refs.treegridObj.ej2Instances; |
| 46 | + treegrid.selectRows([5,6,7]); |
| 47 | + //treegrid.clearSelection(); //To clear the selection |
| 48 | + } |
| 49 | + }, |
| 50 | + provide:{ |
| 51 | + treegrid:[Page] |
| 52 | + } |
| 53 | +} |
| 54 | +</script> |
| 55 | + |
| 56 | +<style> |
| 57 | + @import "../node_modules/@syncfusion/ej2-base/styles/material.css"; |
| 58 | + @import "../node_modules/@syncfusion/ej2-buttons/styles/material.css"; |
| 59 | + @import "../node_modules/@syncfusion/ej2-calendars/styles/material.css"; |
| 60 | + @import "../node_modules/@syncfusion/ej2-dropdowns/styles/material.css"; |
| 61 | + @import "../node_modules/@syncfusion/ej2-inputs/styles/material.css"; |
| 62 | + @import "../node_modules/@syncfusion/ej2-navigations/styles/material.css"; |
| 63 | + @import "../node_modules/@syncfusion/ej2-popups/styles/material.css"; |
| 64 | + @import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css"; |
| 65 | + @import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css"; |
| 66 | + @import "../node_modules/@syncfusion/ej2-vue-treegrid/styles/material.css"; |
| 67 | +
|
| 68 | + .e-btn{ |
| 69 | + margin: 1%; |
| 70 | + } |
| 71 | +</style> |
0 commit comments