Object.assign problem

Hi,

I'm trying to add subtasks to the gantt data using copies of other task data like:

Object.assign({}, taskdata)

The info in the data array is ok but, the gantt don´t render this tasks. Any idea why?

Thanks.

1 Reply

JR John Rajaram Syncfusion Team August 2, 2018 01:16 PM UTC

Hi Oscar, 
Thank you for contacting Syncfusion support 
We have analyzed your reported issue and code snippet. In Gantt we need to provide the dataSource type as the array of object. But in your provided code snippet you have passed the dataSource as the Object type in your application. We suggest you to provide the dataSource type as the array of object. Please refer the below code snippet. 
[TS] 
constructor() { 
       var ganttData = [{ 
            taskID: 1, 
            taskName: "Planning", 
            startDate: "02/03/2014", 
            endDate: "02/07/2014", 
            progress: 100, 
            duration: 5, 
            subtasks: [ 
                { taskID: 2, taskName: "Plan timeline", startDate: "02/03/2014", endDate: "02/07/2014", duration: 5, progress: 100 }, 
                { taskID: 3, taskName: "Plan budget", startDate: "02/03/2014", endDate: "02/07/2014", duration: 5 }, 
                { taskID: 4, taskName: "Allocate resources", startDate: "02/03/2014", endDate: "02/07/2014", duration: 5, progress: 100 }, 
                { taskID: 5, taskName: "Planning complete", startDate: "02/07/2014", endDate: "02/07/2014", duration: 0, progress: 0 } 
            ] 
        }] 
        
        var data = (<any>Object).assign([], ganttData) 
        this.ganttData = data 
} 
 
 We have prepared the sample for your reference, please find the sample link below 
Please let us know if you require further assistance on this. 
Regards, 
John R 


Loader.
Up arrow icon