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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exception: this.parent.activeView is undefined

Thread ID:

Created:

Updated:

Platform:

Replies:

147433 Sep 10,2019 05:08 PM UTC Sep 16,2019 04:34 AM UTC Angular - EJ 2 3
loading
Tags: Schedule
Unknown
Asked On September 10, 2019 05:11 PM UTC

Hello!
I'm trying to reload events dynamically using subscription to RxJS subject but sometimes get the following exception on page load:

ERROR TypeError: "this.parent.activeView is undefined"
    getQuery ej2-schedule.es2015.js:4691
    addEvent ej2-schedule.es2015.js:4755
    addEvent ej2-schedule.es2015.js:11884
    ngAfterViewInit crews-scheduler.component.ts:80

It seems Schedule instance is not always fully instantiated inside AfterViewInit of the parent component.
Do you provide any event that I can catch and start to load scheduler events?
Here is the part of my component:

@ViewChild('scheduleObj', { static: true })
public scheduleObj: SyncfusionScheduleComponent;

ngAfterViewInit() {
        this.loadedEvents$.subscribe(events => {
// getEvents() fails sometimes here too, but this is not critical since I can skip removing if it is the first load
            if (this.scheduleObj.eventBase) {
                const existingEvents = this.scheduleObj.getEvents() as any[];
                if (existingEvents && existingEvents.length > 0)
                    this.scheduleObj.deleteEvent(existingEvents);
            }
            if (events.length > 0)
                this.scheduleObj.addEvent(events.map(clone)); // here I get the exception!
        });
    }

Vinitha Devi Murugan [Syncfusion]
Replied On September 11, 2019 01:41 PM UTC

Hi Artem, 
 
Syncfusion Greetings. 
 
We have checked your shared scenario but scheduler working fine at our end. We suspect that your requirement is to update the scheduler event on ngAfterViewInit we have prepared the below sample for the same kindly refer it. 
 

ngAfterViewInit() { 
    const studentsObservable = this.scheduleService.getSchedule(); 
    studentsObservable.subscribe((scheduleData: Schedule[]) => { 
      this.scheduleObj.eventSettings.dataSource = scheduleData; 
    }); 
  } 
 
Kindly try with the above sample and let us know if you need any further assistance on this.  
 
Regards, 
M.Vinitha devi 
 


Unknown
Replied On September 13, 2019 08:15 AM UTC

Thank you! It seems it works well.

Karthigeyan Krishnamurthi [Syncfusion]
Replied On September 16, 2019 04:34 AM UTC

 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon