[fetchdata.vue.html]
<template>
<div>
<ejs-grid ref='grid' :dataSource="data" allowPaging="true" :toolbar="toolbar" :editSettings="editSettings" >
<e-columns>
. . . .
</e-columns>
</ejs-grid>
</div>
</template>
<script src="./fetchdata.ts"></script>
<style>
@import "https://cdn.syncfusion.com/ej2/material.css";
</style>
[fetchdata.ts]
import Vue from "vue";
import axios from 'axios';
import VueAxios from 'vue-axios';
import { GridPlugin, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { DataManager, RemoteSaveAdaptor } from "@syncfusion/ej2-vue-grids/node_modules/@syncfusion/ej2-data"; // Refer this path of EJ2 Grid dependencies
import Component from "vue-class-component";
. . . .
Vue.use(GridPlugin);
export default Vue.extend({
data: () => {
return {
toolbar: ['Add', 'Edit','Delete','Update','Cancel'],
editSettings: { allowAdding: true, allowEditing:true, allowDeleting:true },
data: new DataManager({
json: localData,
insertUrl: "Home/Insert",
updateUrl: "Home/Update",
removeUrl: "Home/Delete",
adaptor: new RemoteSaveAdaptor(),
}),
};
},
provide: {
grid: [Page, Toolbar,Edit] // You need to provided a required module here
}
}); |