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

Error in EventSettingsModel with DataManager

Hello.

I try to fetch remote data reading this example

https://ej2.syncfusion.com/angular/documentation/schedule/data-binding

There is an error in this line:

public eventSettings: EventSettingsModel = { dataSource: this.dataManger };

The error is:

El tipo 'DataManager' no se puede asignar al tipo 'Object[] | DataManager'.
'DataManager' type cannot be assigned to 'Object[] | DataManager' type
[...]
(property) EventSettingsModel.dataSource?: Object[] | DataManager

This is the code

import { Component, ViewEncapsulation } from '@angular/core';
import { PopupOpenEventArgs, MonthService, DayService, WeekService, WorkWeekService, EventSettingsModel } from '@syncfusion/ej2-angular-schedule';
import { DropDownList } from '@syncfusion/ej2-dropdowns';
import { DataManager, UrlAdaptor } from '@syncfusion/ej2-data';
import { citasService } from './citas.service';
import { DateTimePicker } from '@syncfusion/ej2-angular-calendars';

@Component({
selector: 'app-agenda',
providers: [DayService, WeekService, WorkWeekService, MonthService, citasService],
templateUrl: 'agenda.component.html',
  styles: [`
    .custom-event-editor .e-textlabel {
      padding-right: 15px;
      text-align: right;
    }
    .custom-event-editor td {
      padding: 7px;
      padding-right: 16px;
    }
  `],
  encapsulation: ViewEncapsulation.None
})

export class AgendaComponent {  
  private citasService: citasService
  private dataManger = new DataManager({
    url: this.citasService.url_enpoint + '/getcitasagenda',
    crudUrl: this.citasService.url_enpoint + '/updatedata',
    adaptor: new UrlAdaptor,
    crossDomain: true
  }); 

  public eventSettings: EventSettingsModel = { dataSource: this.dataManger }; // The error is here

  public showQuickInfo: boolean = false;
  public selectedDate: Date = new Date(2018, 1, 15);
}


Thank you


1 Reply

KK Karthigeyan Krishnamurthi Syncfusion Team November 5, 2018 04:21 AM UTC

Hi Luis,  
 
Thank you for contacting Syncfusion support. 
 
In the provided code example DataManager type is not defined which is the cause for the issue. Kindly include the type as highlighted below to overcome the reported issue. 
 
export class RemoteDataComponent { 
            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 }; 
        } 
 
Regards, 
Karthigeyan 


Loader.
Live Chat Icon For mobile
Up arrow icon