Page 1 of 1

[ANGULAR] Change recurring time range start date.

Posted: Mon Feb 08, 2021 4:51 pm
by tomerPlanit

Hi, We are working with Scheduler 4.0.2v and angular 10.

I need be able to change the start date of recurring time ranges.

When I create recurring time ranges, I put start date from where the range start, on some actions like zoom or scroll I get empty zones of time ranges, because the time span changed.

For solve this I listening on this event:

 scheduler.on('timeAxisChange', this.timeAxisChange.bind(this));

Then I take the config start date of the event(this is the new start date of the time span) and call my update function.

  timeAxisChange(event: {
    config: IDateRange,
    source: Scheduler,
    type: string
  }) {
    this.updateRecurringTimeRanges(event.config.startDate, event.source);
  }

And in this function I go over all recurring time ranges in the system, and update the start date by new span start date(in my case the minuts and hourse must be as the default time range).

  updateRecurringTimeRanges(startDate: Date, scheduler: Scheduler) {
    const allRecurringTimeRanges: TimeSpan[] = scheduler.features.timeRanges.store.getRange();
    if (allRecurringTimeRanges.length !== 0) {
      allRecurringTimeRanges.forEach((timeRange: TimeSpan) => {
      
// Set the start date by use new start date. startDate.setHours( (timeRange.startDate as Date).getHours(), (timeRange.startDate as Date).getMinutes(), 0, 0 ); console.log(startDate); timeRange.startDate = startDate.toISOString(); }); } }

It is work but I get empty zone from recurring time ranges in previous start date.
What I am doing wrong?


Re: [ANGULAR] Change recurring time range start date.

Posted: Tue Feb 09, 2021 2:13 pm
by saki

Would you please post a showcase that we can run, investigate and debug? Your logic seems to be all right so we need to sort out if it's a problem elsewhere in your app or in the underlying Scheduler code.

Also, you may want to try it with the latest scheduler version 4.0.8; there shouldn't be breaking changes from 4.0.2.


Re: [ANGULAR] Change recurring time range start date.

Posted: Wed Feb 17, 2021 3:12 pm
by tomerPlanit

Hi,
I upgraded to scheduler to 4.0.8 version and get the same problem.

I created example for you based on angular 8 example version 4.0.8.
In the example I created 3 recurring time ranges at 6AM, 4PM, 10PM and add scroll buttons in the top toolbar.

For see the problem you need:
1) Click on left scroll button in the top toolbar(for scroll left because the view is in max left scheduler span) by this action you call the scheduler timeAxisChange event that makes updates of time ranges.
2) Scroll to to start of the span by use the scheduler base scroll bar in the bottom.
3) Click on left scroll button in the top toolbar by this action you call the scheduler timeAxisChange again.

Now you can see that you get some empty zone from time ranges.

What I am doing wrong?


Re: [ANGULAR] Change recurring time range start date.

Posted: Wed Feb 17, 2021 10:41 pm
by saki

It looks like a bug. I'll investigate it in more details tomorrow and I'll let you know the findings.


Re: [ANGULAR] Change recurring time range start date.

Posted: Thu Feb 18, 2021 11:06 am
by saki

Yes, it is a bug, the issue is here: https://github.com/bryntum/support/issues/2403


Re: [ANGULAR] Change recurring time range start date.

Posted: Sat Apr 17, 2021 5:27 pm
by mats

The real bug here sounds like this:

When I create recurring time ranges, I put start date from where the range start, on some actions like zoom or scroll I get empty zones of time ranges, because the time span changed.

Should not require any listening to timeAxisChange for recurring time ranges to work. Can you please provide a simple test case showing the issue where you get "empty zones of time ranges"?