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

Property 'makeDraggable' does not exist on type 'typeof Calendar'.

Asked by Stef
3 years ago.

This question is similar to https://forums.daypilot.org/question/3743/typescript-cant-find-property-makedraggable, however, now applied to the Calendar component.

I am working with the implementation which can be downloaded from the following page: https://code.daypilot.org/72781/angular-work-order-scheduling-php-mysql.

Now I am trying to change the Scheduler to a Calendar view. This seems to work for all basic components.
In scheduler.component.ts, I am importing DayPilotCalendarComponent:

 import {DayPilot, DayPilotCalendarComponent, DayPilotSchedulerComponent} from "daypilot-pro-angular";
and adjusted the HTML template:
      <daypilot-calendar [config]="config" [events]="events" #scheduler></daypilot-calendar> 
      <!--    <daypilot-scheduler [config]="config" [events]="events" #scheduler></daypilot-scheduler>-->

This leads to a change from Scheduler to Calender (with the different functionalities correctly working).

However, adjusting the following code to enable the method makeDraggable for Calender (https://api.daypilot.org/daypilot-calendar-makedraggable/):

@Directive({ selector: '[draggableToScheduler]' })
export class DraggableDirective implements AfterViewInit {

  @Input('draggableToScheduler') options: any;

  constructor(private el: ElementRef) { }

  ngAfterViewInit(): void {
    this.options.element = this.el.nativeElement;
    // DayPilot.Scheduler.makeDraggable(this.options);
    DayPilot.Calendar.makeDraggable(this.options);
  }
}

leads to the following error: error TS2339: Property 'makeDraggable' does not exist on type 'typeof Calendar'.

Could it be that I am missing an import of the Calendar component somewhere?

Answer posted by Dan Letecky [DayPilot]
3 years ago.

The DayPilot.Calendar.makeDraggable() method was missing in the TypeScript definitions. It's now added in the latest sandbox build (2021.1.4829).

As a workaround, you can cast the DayPilot object to any:

// ...
const d = DayPilot as any;
d.Calendar.makeDraggable(this.options);
Comment posted by Stef
3 years ago.

Thanks a lot!

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.