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

Schedule component is not showing events that were bind from API?

Thread ID:

Created:

Updated:

Platform:

Replies:

149227 Nov 19,2019 12:59 PM UTC Nov 20,2019 07:35 AM UTC Angular 1
loading
Tags: ejSchedule
Wioletta Manka
Asked On November 19, 2019 12:59 PM UTC

I'm using Angular 6 and .NET Core Web API. My controller is sending calendar events as json like this:



My angular component template looks like this:
<ejs-schedule
  #scheduleObj
  width="100%"
  height="650px"
  [currentView]="currentView"
  [views]="views"
  [readonly]="true"
  [selectedDate]="selectedDate"
  [eventSettings]="eventSettings"
  [allowDragAndDrop]="false"
  [allowResizing]="false"
  (eventRendered)="oneventRendered($event)"
  (popupOpen)="onPopupOpen($event)"
>
</ejs-schedule>

And this is CalendarComponent.ts file
export class CalendarComponent {
  public currentViewView = 'Month';
  public viewsView[] = ['Day''Week''Month'];
  public scheduleObjScheduleComponent;
  public selectedDateDate = new Date();
  private dataMangerDataManager = new DataManager({
    url:
      environment.apiUrl +
      'calendar/' +
      this.authService.getCurrentlyLoggedInUserId(),
    adaptor: new ODataV4Adaptor(),
    crossDomain: true
  });
  public eventSettingsEventSettingsModel = { dataSource: this.dataManger };
  public tempstring =
    '<div class="tooltip-wrap">' +
    '<div class="image ${EventType}"></div>' +
    '<div class="content-area"><div class="name">${Subject}</></div>' +
    '${if(Location !== null && Location !== undefined)}<div class="location">Location&nbsp;:&nbsp;${Location}</div>${/if}' +
    '<div class="time">From&nbsp;:&nbsp;${StartTime.toLocaleString()} </div>' +
    '<div class="time">To&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;${EndTime.toLocaleString()} </div></div></div>';

  constructor(private routerRouterprivate authServiceAuthService) {}

  onChange(argsChangeEventArgs): void {
    if (args.checked) {
      this.scheduleObj.eventSettings.enableTooltip = true;
    } else {
      this.scheduleObj.eventSettings.enableTooltip = false;
    }
    this.scheduleObj.dataBind();
  }

  onTemplateChange(argsChangeEventArgs): void {
    if (args.checked) {
      this.scheduleObj.eventSettings.tooltipTemplate = this.temp;
    } else {
      this.scheduleObj.eventSettings.tooltipTemplate = null;
    }
    this.scheduleObj.dataBind();
  }
  oneventRendered(argsEventRenderedArgs): void {
    const categoryColorstring = args.data.CategoryColor as string;
    if (!args.element || !categoryColor) {
      return;
    }
    args.element.style.backgroundColor = categoryColor;
  }

  onPopupOpen(argsPopupOpenEventArgs): void {
    if (args.type === 'Editor' || args.type === 'QuickInfo') {
      args.cancel = true;
      this.router.navigate(['/']);
    }
  }
}


Currently the data is send correctly but calendar component is still empty, what should I do to fix that?






Vinitha Devi Murugan [Syncfusion]
Replied On November 20, 2019 07:35 AM UTC

Hi Wioletta, 
 
Syncfusion Greetings. 
 
We have checked your shared code in which field mapping is incorrect, which is the root cause of the reported issue. We prepared the sample below with the right field mapping, please refer to it. 
 
 
 public eventSettings: EventSettingsModel = { dataSource: [ { 
        id: 1, 
        subject: 'Story Time for Kids', 
        startTime: new Date(2018, 1, 11, 10, 0), 
        endTime: new Date(2018, 1, 11, 11, 30), 
        CategoryColor: '#1aaa55' 
    }], 
     fields: { 
            id: 'id', 
            subject: { name: 'subject' }, 
            startTime: { name: 'startTime' }, 
            endTime: { name: 'endTime' } 
        }}; 
 
Please refer below UG link. 
 
Regards, 
M. Vinitha devi 


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