Cannot add a task to an empty dataSource array.

When the dataSource of a Gantt chart is an empty array new tasks are not shown within the chart upon creation.
This is true for both toolbar and manual methods.

This Stackblitz demonstrates the issue https://stackblitz.com/edit/angular-ivy-qw6u99

If the dataSource has an initial value both the add methods work as expected.

2 Replies

LG Logeswari Gopalakrishnan Syncfusion Team May 15, 2020 05:06 AM UTC

Hi David, 
 
We have analyzed your query and we are able to reproduce issue. We have already log this as bug. You can track the status of this issue using below feedback link. 
  
  
This fix will be available in our upcoming weekly release, which is expected to be rolled out on May 20,2020.  We will let you know once it gets rolled out.   
 
However we achieved this also by work-around solution by calling refresh method after add record.  
 
Please find the below code snippet.  
[app.component.html] 
<button ejs-button id='addRecord' (click)='add()'>Add New Record</button> 
<ejs-gantt id="ganttDefault" #editing height="100%" [dataSource]="data" 
           " (actionComplete)="actionComplete($event)"> 
</ejs-gantt> 
 
[app.component.ts] 
 
public ngOnInit(): void { 
        this.data = []; 
..//// 
 
} 
public actionComplete(args: any): void { 
      if (args.action === "add" && args.requestType === "add") { 
        var obj = document.getElementById("ganttDefault").ej2_instances[0]; 
        setTimeout( () => { 
          obj.refresh(); 
        }, 100); 
      } 
    } 
public add(): void { 
        let record: object = { 
            TaskID: 9, 
            TaskName: 'Identify Site location', 
            StartDate: new Date('04/02/2019'), 
            Duration: 3, 
            Progress: 50 
            }; 
            this.ganttObj.editModule.addRecord(record,'Top'); 
    }; 
 
Please find below sample link. 
  
  
We appreciate your patience until then. 
  
Regards, 
Logeswari G 



LG Logeswari Gopalakrishnan Syncfusion Team May 20, 2020 08:12 AM UTC

Hi David  
    
Thanks for your patience.   
   
We have fixed the reported issue mentioned in the following feedback link https://www.syncfusion.com/feedback/14168/dialog-size-shrinks-when-gantt-height-is-very-small.  
   
Please find the release notes from below link. 
   
Please upgrade your Gantt packages to the highest version v18.1.53. We have prepared a sample with latest source, please find the sample from below link.     
 
  
 
 
Regards,     
Logeswari G 


Loader.
Up arrow icon