selected Date - mobile View

when I have mobile view & persistent == true & grouped Data, I always have not the 1.1.2024 - I have some date - but not the right on - the selected date is right... where does this date come from?

thanks



3 Replies

VR Vijay Ravi Syncfusion Team April 4, 2024 09:56 AM UTC

Hi Isabelle,


When enabling persistence, we maintain the last selected date in the browser's local storage. State persistence allows the Scheduler to retain the current view, selected date, and scroll position values in the localStorage for state maintenance, even if the browser is refreshed or if you navigate 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, the current view, selected date, and scroll position values of the Scheduler component will be maintained in browser's local storage even after refreshing the page.


Documentation: https://ej2.syncfusion.com/vue/documentation/schedule/state-persistence


Please let us know if you need any further assistance.


Regards,

Vijay



IF Isabelle Fuchs April 4, 2024 10:12 AM UTC

can I overwrite the date? because it is really confusing our customer that in the month view there is the date 26.1 instead of 1.1 as usually....persistence is necessary that he remembers the selected employee... so this I can´t set to false...



VR Vijay Ravi Syncfusion Team April 9, 2024 04:37 PM UTC

Hi Isabelle,


Currently, we do not have a direct option for overriding. However, when initializing the component, we read from local storage to retrieve the stored value of the selected date. The module is named "schedule" with a schedule ID of "scheduleID." We reset it on your end Additionally we prepare the sample for your requirement for overwrite the date? As shown in the below highlighted code snippet. Please try our shared sample as an workaround solution for your requirement.


[app.vue]


 <ejs-schedule

          :id="scheduleId"

          ref="ScheduleObj"

          :enablePersistence="enablePersistence"

        >

        </ejs-schedule>

      </div>

    </div>

  </div>

</template>

 

<script>

 

export default {

  components: {

    'ejs-schedule': ScheduleComponent,

    'e-view': ViewDirective,

    'e-views': ViewsDirective,

    'e-resource': ResourceDirective,

    'e-resources': ResourcesDirective,

  },

  data: function () {

    return {

      scheduleId: 'scheduleID',

      eventSettings: {

        dataSource: this.generateData(),

      },

      reset: this.resetPersitence(),

      enablePersistence: true,

      selectedDate: new Date(),

      allowMultiple: true,

      group: {

        resources: ['Employees'],

      },

      employeeDataSource: [

        { text: 'Nancy'id: 1groupId: 1color: '#df5286' },

        { text: 'Steven'id: 2groupId: 1color: '#7fa900' },

        { text: 'Robert'id: 3groupId: 2color: '#ea7a57' },

        { text: 'Smith'id: 4groupId: 2color: '#5978ee' },

        { text: 'Michael'id: 5groupId: 3color: '#df5286' },

        { text: 'Root'id: 6groupId: 3color: '#00bdae' },

      ],

    };

  },

  provide: {

    schedule: [DayWeekMonthDragAndDropResize],

  },

  methods: {

    resetPersitence: function () {

      let datastring = localStorage.getItem('schedule' + 'scheduleID');

      if (!(data === null || data === undefined || data === '')) {

        let browserdata = JSON.parse(data);

 

        browserdata.selectedDate = new Date();

 

        localStorage.setItem(

          'schedule' + 'scheduleID',

          JSON.stringify(browserdata)

        );

      }

    },



Sample: Snkeyq (forked) - StackBlitz


Please get back to us with the required details for further assistance.


Regards,

Vijay


Loader.
Up arrow icon