I am using scheduler for setting Appointments in my Angular6 App. It works fine with static data but not binding any data with Web Api call?

It works with this remote Api provided by them https://js.syncfusion.com/demos/ejservices/api/Schedule/LoadData and with static data in component.ts but not with my local web API

My Component.ts code is as follows :-

@Component({
  selector: 'app-scheduler',
  templateUrl: './scheduler.component.html',
  styleUrls: ['./scheduler.component.css'],
  providers: [DayService, WeekService, MonthService],
})
export class SchedulerComponent implements OnInit {
  scheduler: any = {
    _id: "",
    id: "",
    Subject: "",
    StartTime: "",
    EndTime: "",
    StartTimezone: "",
    EndTimezone: "",
    Location: "",
    Description: "",
    IsAllDay: false,
    Recurrence: "",
    RecurrenceRule: "",
    Frequency: "",
    Interval: "",
    Count: "",
    IsReadonly: false,
    IsBlock: false,
    Untill: "",
    ByDay: "",
    BYMonthDay: "",
    BYMonth: "",
    BYSetPOS: ""
  }
  //public dataManager: any;
  public query;
  public ajax: any;

  actionModel: any;
  ds: any;
  public currentView: View = 'Month';
  public selectedDate: Date = new Date();

  private dataManager: DataManager = new DataManager({
    url: 'https://localhost:44369/api/Scheduler/getcalls',

    adaptor: new WebApiAdaptor,
    crossDomain: true
  });

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



  constructor(
    protected service: SchedulerService, protected callService: CallService, protected meetingService: MeetingService,
    protected taskService: TaskService,  protected commentService: CommentService
  )
  {
    this.UpdateScheduler();
  }

  ngOnInit() {
    this.ds = [];
  }
  async UpdateScheduler() {
    debugger
    await this.service.getSchedulerData<any>()
      .subscribe(data => {
        data.map((x) => {
          this.ds.push({
            Id: x.id,
            Subject: x.subject,
            StartTime: new Date(x.startTime).toISOString().slice(0, -1),
            EndTime: new Date(x.endTime).toISOString().slice(0, -1),
            IsAllDay: x.allDay,
            Recurrence: true,
            RecurrenceID: x.Id,
            RecurrenceRule: 'FREQ=DAILY;INTERVAL=1;COUNT=5',
            Location: x.location,
            Description: x.description,
            StartTimezone: x.startTimezone,
            EndTimezone: x.EndTimezone,
          })
          console.log("ds1", this.ds);
          this.eventSettings.dataSource = this.ds;
          console.log("finalDataSource",this.eventSettings.dataSource);
        });
      }, error => {
        console.log("error1", error);
      }, () => { });
    //this.service.getSchedulerData();
   // this.eventSettings.dataSource = this.ds;
  }



  fnSchedulerModel(): any {
    return {
      _id: "",
      Subject: "",
      Location: "",
      ResponsiblePerson: "",
      Priority: "",
      Types: "",
      CreatedBy: "",
      UpdatedBy: "",
      CreatedDate: "",
      UpdatedDate: "",
      EventStartDate: "",
      EventEndDate: "",
      ReminderNotification: "",
      Completed: false,
      Description: "",
      RepeatTask: 0,
      Interval: "",
      RepeatAfter: "",
      Untill: "",
      UntillDate: "",
      UntillCompile: "",
      RemindUsing: "",
      RemindTo: "",
      RepeatEvery: "",
      RepeatOnWeekDay: "",
      RepeatOnDay: "",
      WillRepeat: "",
      WillRepeatWeekDay: "",
      RepeatOnMonth: ""
    }
  }

}

The API I am calling is :-

WebApiCode:-

[HttpGet("GetCalls")]
        public List<DefaultSchedule> GetCalls(String CurrentDate, String CurrentView, String CurrentAction)
        {
            IEnumerable<Calls> model = _callRepository.GetAllCalls();
            List<DefaultSchedule> schedulerModelList = new List<DefaultSchedule>();
            int Id = 0;
            foreach (var call in model.ToList())
            {

                DefaultSchedule schedulerModel = new DefaultSchedule();
                schedulerModel.Id = 100;
                schedulerModel.AllDay = call.IsAllDay;
                schedulerModel.Description = call.Description;
                schedulerModel.StartTime = DateTime.Today;
                schedulerModel.StartTimeZone = call.StartTimeZone;
                schedulerModel.EndTime = DateTime.Today.AddDays(1);
                schedulerModel.Priority = true;
                schedulerModel.Subject = "CJECL";
                schedulerModel.Owner = 1;
                schedulerModelList.Add(schedulerModel);
                break;
            }
            return schedulerModelList;

        }

It works fine with static data and with this web Api https://js.syncfusion.com/demos/ejservices/api/Schedule/LoadData when i provide data in component itself but when I have to bind data from WebApi it's not working. Please help.

My requirement is to bind remote data to scheduler. demo is provided below please have a look :-

https://help.syncfusion.com/angular/schedule/data-binding#binding-remote-data-service

1 Answers

0
Karthigeyan On

Greetings from Syncfusion.

In Schedule, batch operation will not work correctly with WebApi adaptor and for the same we have logged the below feature request which will be implemented in any one of our upcoming release. https://www.syncfusion.com/feedback/2373/batch-handler-support-for-asp-net-core-while-using-webapi-adaptor

Regards, Karthi