Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150441 | Jan 7,2020 01:10 PM UTC | Jan 10,2020 03:20 PM UTC | Vue | 8 |
![]() |
Tags: Data Grid |
<template>
<div>
<ejs-grid
ref="grid"
:columns="sourceColumns"
:dataSource="rows"
:allowGrouping="true"
:groupSettings="groupSettings"
:aggregates="aggregates"
/>
</div>
</template>
<script>
import Vue from "vue";
import {
GridPlugin,
Aggregate,
ExcelExport,
Group,
PdfExport,
Resize,
VirtualScroll
} from "@syncfusion/ej2-vue-grids";
Vue.use(GridPlugin);
export default {
name: "Grid",
data() {
return {
columns: [],
rows: [],
sourceColumns: [
{
field: "name",
headerText: "Name"
},
{
field: "location",
headerText: "Location"
},
{
field: "purchase",
headerText: "Purchase"
}
],
sourceRows: [
{
name: "John Doe",
location: "Paris",
purchase: 3
},
{
name: "John Doe",
location: "Paris",
purchase: 5
},
{
name: "John Doe",
location: "London",
purchase: 7
},
{
name: "Jane Doe",
location: "London",
purchase: 9
}
],
groupBy: ["name"],
aggregates: {
columns: []
}
};
},
computed: {
groupSettings() {
return {
showDropArea: false,
columns: this.groupBy
};
}
},
mounted() {
// it requires no time delay
//here you can change the columns and dataSource
this.columns = this.sourceColumns;
this.rows = this.sourceRows;
this.groupBy = ["location", "name"];
},
provide: {
grid: [Aggregate, ExcelExport, Group, PdfExport, Resize, VirtualScroll]
}
};
</script>
<style>
</style>
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.