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

Event handling method

Asked by daniels
1 year ago.

We are using Scheduler within an Angular 5 component. Is there a location other than the Scheduler's config object that event handlers (eg. onResourceExpand) can be defined?

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

You can define the event handlers directly on the DayPilot.Scheduler object (which is available as DayPilotComponent.control).

Just note that DayPilotComponent.control is not available before AfterViewInit:

import {Component, ViewChild, AfterViewInit} from "@angular/core";
import {DayPilotSchedulerComponent} from "daypilot-pro-angular";

@Component({
  selector: 'angular2-scheduler-example',
  template: `<daypilot-scheduler #scheduler1></daypilot-scheduler>`
})
export class AppComponent implements AfterViewInit {

  @ViewChild("scheduler1")
  scheduler: DayPilotSchedulerComponent;

  ngAfterViewInit(): void {
    this.scheduler.control.onResourceExpand = (args) => { this.scheduler.control.message("Expanded"); };
  }
}

See also:
https://doc.daypilot.org/scheduler/angular-2/
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.