Hi Stas,
Thanks for contacting Syncfusion support.
Based on your request we have created and attached a sample for testing the Data Grid. In this sample, we have used the “goToPage” method of Grid to navigate to the second page. At this time the “actionBegin” event will be triggered. In the “actionBegin” event handler function we have updated the value for the “currentPage”. Please download the sample from the link below,
Please refer the code example below,
[App.vue]
<template>
<div>
<div class="control-section">
<ejs-grid :dataSource="dataS" ref="grid" :allowPaging='true' :actionBegin="actionBegin"></ejs-grid>
</div>
</div>
</template>
<script>
import Vue from "vue";
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons';
import { GridComponent,GridPlugin, Page } from '@syncfusion/ej2-vue-grids';
Vue.use(GridPlugin);
export default Vue.extend({
name: "Default",
data: function() {
return {
previousPage:0,
currentPage:0,
...
};
},
methods: {
actionBegin(args) {
switch (args.requestType) {
case 'paging': {
this.currentPage = args.currentPage;
this.previousPage = args.previousPage;
break;
}
}
}
},
provide: {
grid: [Page]
}
});
</script>
[Default.spec.js]
describe(' Button component render', () => {
var vm;
...
it(' Test the created event', (done) => {
vm.$refs.grid.ej2Instances.goToPage(2);
expect(vm.currentPage).toBe(2);
done();
})
})
Note : Use commands from the README.md file to run the test case.
Please get back to us if you need further assistance.
Regards,
J Mohammed Farook