Theodor
Theodor

Reputation: 11

Syncfusion Gantt - No records to display after calling the API

I tried to use the syncfusion gantt chart, but it is not working properly:

This is the code i've been using to display the data from my API:

import { Component } from '@angular/core';
import {DataManager, WebApiAdaptor} from '@syncfusion/ej2-data';

@Component({
  selector: 'app-reporting',
  templateUrl: './reporting.component.html',
  styleUrls: ['./reporting.component.scss']
})
export class ReportingComponent {
  public data: DataManager = new DataManager({
    url: 'https://localhost:7209/api/ActualTasks',
    adaptor: new WebApiAdaptor,
    crossDomain: true
  });
  public taskSettings: object = {
    id: "actualTasksID",
    name: "name",
    startDate: "start_time",
    endDate: "end_time",
    parentID: "parentID"
  }
}

The HTML code:

<ejs-gantt height="600px"
[dataSource]="data"
[taskFields]="taskSettings"
>
</ejs-gantt>

And what data i receive from the API URL:

{
    "actualTasksID": 18,
    "name": "Task",
    "description": "Curatare",
    "attachment": "Se vor curata tastele",
    "active": "isNotActive",
    "start_time": "2023-09-20T08:40:00",
    "end_time": "2023-09-27T08:40:00",
    "operator_id": 1,
    "workOrderID": 13,
    "workOrder": null,
    "operator": null
  }

I think they are using something with the parents to display the data.

This is the message i get, i attached an image. Any ideas how i could modify my code so i can display the data? API from Syncfusion

I would expect my code to work, as i get the data from the API on other routes, like in the image, i thought it should work properly in syncfusion aswell. API called by me

Upvotes: 1

Views: 88

Answers (0)

Related Questions