<template>
<div class="col-lg-12 control-section">
<div>
<ejs-grid :dataSource="data" :dataBound='dataBound'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='130' format="yMd" textAlign='Right'></e-column>
<e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right'></e-column>
<e-column field='ShippedDate' headerText='Shipped Date' width='130' format="yMd" textAlign='Right'></e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150'></e-column>
</e-columns>
</ejs-grid>
</div>
</div>
</template>
<script lang="ts">
import Vue from "vue";
import { GridPlugin , Resize } from "@syncfusion/ej2-vue-grids";
import { orderDetails } from "./data-source";
Vue.use(GridPlugin);
export default Vue.extend({
data: () => {
return {
data: orderDetails.slice(0, 12)
};
},
methods: {
dataBound: function() {
// or you can autofit the Grid columns as below
this.$refs.grid.ej2Instances.autoFitColumns([]);
}
},
provide: {
grid: [Resize]
}
});
</script> |