We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Getting Schedule control undefined error on custom event

I am trying to implement a scheduler calendar that gets the details of an appointment on double click. So I have this method EventRendered to add Event Listener for doubleclick.

It goes to the method customClick when double click is fired, it says that the this.scheduleObj is undefined


@ViewChild('scheduleObj')
public scheduleObj: ScheduleComponent;

public onEventRendered(args: EventRenderedArgs){
args.element.addEventListener('dblclick', this.customClick);
}

public customClick(apptDetails) {
// You can write a code for new functionality to event click here
if (apptDetails.detail === 2) {
let eventObj: ATIAppointment;
let resource: ResourceDetails
if (apptDetails && apptDetails.currentTarget.classList.contains('e-appointment')) {
const a = this.scheduleObj.getEventDetails(apptDetails.currentTarget) //as ATIAppointment;
}
}
}

1 Reply

SK Satheesh Kumar Balasubramanian Syncfusion Team October 26, 2021 01:53 PM UTC

Hi BOB,

Thanks for using Syncfusion Products.

We have validated your reported query "Getting Schedule control undefined error on custom event" and prepared sample to get appointment details of an appointment on double click.


app.component.ts:   
  public onEventRendered(argsEventRenderedArgs) {
    // Adding the custom click event to the type "A" event
    if (args.data.EventType === 'A') {
      args.element.addEventListener('dblclick'this.customClick.bind(this));
    }
  }

  public customClick(args) {
    // You can write a code for new functionality to event click here
    if (args.detail === 2) {
      console.log('Custom click event fires');
      const a = this.scheduleObj.getEventDetails(args.currentTarget);
      console.log(a);
    }
  }

Kindly try the above sample and let us know if this meets your requirement.

Regards,
Satheesh Kumar B



Loader.
Up arrow icon