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

Get dataSource onInit. Get empty data source

Thread ID:

Created:

Updated:

Platform:

Replies:

144738 May 20,2019 02:01 PM UTC May 27,2019 11:40 AM UTC Angular - EJ 2 3
loading
Tags: Schedule
Unknown
Asked On May 20, 2019 02:01 PM UTC

Hello,

I am trying to set data source onInit but I am getting no data in my schedule. I am trying to do it from example: https://stackblitz.com/edit/angular-e6agtu-d4jsxx?file=app.component.ts

Also in my case I am using TimeLine grouping functionality (like in this example: https://ej2.syncfusion.com/angular/demos/#/material/schedule/timeline-resource-grouping). I am using fro that remote data.

When I am trying to set data onInit as empty array (or do not set dataSource at all) I am getting error:


My code looks something like this:

And onInit I am settings all data sources as empty array like:



Nevitha Ravi [Syncfusion]
Replied On May 21, 2019 07:34 AM UTC

Dear customer, 

Greetings from Syncfusion Support. 

We have checked your sample in which ngOnInit is misspelled which results in empty scheduler. We have modified the sample which can be viewed from the following link. 

import { Component, OnInit } from '@angular/core'; 
import { EventSettingsModel, View, DayService, WeekService, WorkWeekService, MonthService, AgendaService } 
  from '@syncfusion/ej2-angular-schedule'; 
import { DataManager, WebApiAdaptor } from '@syncfusion/ej2-data'; 
 
@Component({ 
  selector: 'app-root', 
  templateUrl: 'app.component.html', 
  providers: [DayService, WeekService, WorkWeekService, MonthService, AgendaService] 
}) 
export class AppComponent implements OnInit { 
  public selectedDate: Date = new Date(2017, 5, 5); 
  public currentView: View = 'Week'; 
  public readonly: boolean = true; 
  private dataManger: DataManager = new DataManager({ 
    url: 'https://js.syncfusion.com/demos/ejservices/api/Schedule/LoadData', 
    adaptor: new WebApiAdaptor, 
    crossDomain: true 
  }); 
  // public eventSettings: EventSettingsModel = { dataSource: this.dataManger }; 
  public eventSettings: EventSettingsModel = {}; 
 
  ngOnInit() { 
    this.eventSettings.dataSource = this.dataManger; 
  } 
 
} 


Regards, 
Nevitha 


Unknown
Replied On May 24, 2019 05:24 AM UTC

Yes, sorry, it was my mistake. It solves the problem with example. But still this does not solve the other problem where I am getting error which was also described in my problem.

Karthigeyan Krishnamurthi [Syncfusion]
Replied On May 27, 2019 11:40 AM UTC

Dear Customer, 
 
Thanks for the update. 
 
We suspect that empty data source is assigned to resource (projectDataSource and categoryDataSource) without giving empty data source to group property which could be the cause. Kindly use the below code example and if the issue persists, try to reproduce the error in a sample and revert. 
 
ngOnInit() { 
    this.eventSettings.dataSource = []; 
    this.projectDataSource = []; 
    this.categoryDataSource = []; 
    this.group.resources = []; 
  } 
 
Regards, 
Karthi 


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