search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Cannot Move back to Current Date on Navigator

Asked by EJ
1 month ago.

Hi,

I seems that once our page load defaulting today's date if you click on another day you cannot select the today's date again. Today's date seems unselectable.

Comment posted by Dan Letecky [DayPilot]
1 month ago.

Are you able to reproduce the problem in the following example?

https://javascript.daypilot.org/sandbox/calendar/navigator.html

It seems to work fine...

Comment posted by EJ
1 month ago.

My application is in Angular. Is this the same version of the control as the Angular one?

Comment posted by Dan Letecky [DayPilot]
1 month ago.

You can download an Angular example here:
https://code.daypilot.org/78004/angular-calendar-date-switching

If you change navigatorConfig.selectMode to "Day" it will let you click individual days.

Please let me know if it still doesn't work.

Comment posted by EJ
1 month ago.

So my component doesn't reload when switching the date back to today's date. It works on any other date.

@Component({
  selector: 'scheduler-sc-component',
  template: `
  <div class="fullscreen">
  <sidebar-container #sidebar [(expanded)]="expanded">
    <sidebar-expanded>
      <div style="padding: 3px;">
      <daypilot-navigator [config]="navigatorConfig" [date]="navigatorDate" (dateChange)="dateChange()" #navigator></daypilot-navigator>
      </div>
    </sidebar-expanded>
    <sidebar-collapsed></sidebar-collapsed>
    <sidebar-main>
      <div class="main-body">
      <app-header></app-header>
        <daypilot-scheduler [config]="config" [events]="events" (viewChange)="viewChange()" #scheduler></daypilot-scheduler>
        <app-footer></app-footer>
        <div class="main-bottom"></div>
      </div>
    </sidebar-main>
  </sidebar-container>
  </div>
`,
styles: [`
  
`]
})
  dateChange() {
    console.log('fire');
    this.config.startDate = this.navigator.control.selectionStart;
    this.config.days = new DayPilot.Duration(this.navigator.control.selectionStart, this.navigator.control.selectionEnd).totalDays() + 1;

  }

Comment posted by Dan Letecky [DayPilot]
1 month ago.

You should update the "navigatorDate" value in dateChange(). Otherwise it remains set to the default value (today). The dateChange event only fires if a change is detected.

Another option is to remove the [date] attribute.

Comment posted by Dan Letecky [DayPilot]
1 month ago.

There is indeed something wrong with the dateChange() firing, I'm checking the problem.

Answer posted by Dan Letecky [DayPilot]
1 month ago.

This issue should be fixed now in the latest sandbox build (2020.4.4804).

Comment posted by EJ
1 month ago.

Is there any plans to push an update out for the library?

New Reply
This reply is
Your name (optional):