Schedule onDayClick not working if page scrolls

UI Components for Angular
Post Reply
tomm0
Posts: 9
Joined: 25 Oct 2017, 17:43

19 Jul 2018, 05:14

This one seems a bit strange, but the onDayClick events seem to fire fine if the page is not scrolled, however if the page scrolls then the event seems to fire for the wrong day, or when clicking on a day on the bottom row, not fire at all.

Code: Select all

import {Component, NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {DialogModule} from 'primeng/dialog';
import 'moment';
import 'fullcalendar';
import {ScheduleModule} from 'primeng/primeng';

@Component({
  selector: 'app-root',
  template: `
    <p-schedule [events]="events" [header]="header"
      (onDayClick)="handleDayClick($event)"></p-schedule>
    <p-dialog header="{{selectedDate | date:'EEEE, MMMM d'}}"
      [(visible)]="display">Content </p-dialog>
  `,
})
export class AppComponentComponent {
  private events: any[];
  private display = false;
  private selectedDate: Date;

  handleDayClick(event: any) {
    const selectedMoment = event.date;
    this.selectedDate = selectedMoment.toDate();
    this.selectedDate.setTime(this.selectedDate.getTime() + (this.selectedDate.getTimezoneOffset() * 60 * 1000));
    this.display = true;
  }
}

@NgModule({
  imports: [BrowserModule, ScheduleModule, DialogModule],
  declarations: [AppComponentComponent],
  bootstrap: [AppComponentComponent],
})
export class AppComponentModule {}

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests