State persistence in Vue Schedule component

20 Mar 20233 minutes to read

State persistence allowed Scheduler to retain the currentView, selectedDate and Scroll position values in the localStorage for state maintenance even if the browser is refreshed or if you move to the next page within the browser. This action is handled through the enablePersistence property which is set to false by default. When it is set to true, currentView, selectedDate and Scroll position values of the scheduler component will be retained even after refreshing the page.

Note: Scheduler id is essential to set state persistence.

The following sample demonstrates how to set state persistence of the Scheduler component.

        <div id='app'>
            <div id='container'>
                <ejs-schedule id='schedule' height='550px' width='100%' :selectedDate='selectedDate' :eventSettings='eventSettings' :enablePersistence='enablePersistence'>
    import Vue from 'vue';
    import { scheduleData } from './datasource.js';
    import {SchedulePlugin, Day, Week, TimelineViews, Month, Agenda } from '@syncfusion/ej2-vue-schedule';

    export default {
        data () {
            return {
                selectedDate: new Date(2018, 1, 15),
                views: ['Day', 'Week', 'TimelineWeek', 'Month', 'Agenda'],
                enablePersistence: true,
                eventSettings: { dataSource: scheduleData }
        provide: {
           schedule: [Day, Week, TimelineViews, Month, Agenda]
  @import "../../node_modules/@syncfusion/ej2-base/styles/material.css";
  @import "../../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
  @import "../../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
  @import "../../node_modules/@syncfusion/ej2-vue-dropdowns/styles/material.css";
  @import "../../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";
  @import "../../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
  @import "../../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
  @import "../../node_modules/@syncfusion/ej2-vue-schedule/styles/material.css";

You can refer to our Vue Scheduler feature tour page for its groundbreaking feature representations. You can also explore our Vue Scheduler example to knows how to present and manipulate data.