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. Image for the cookie policy date

Gantt chart - Specified start & end date gets overridden on enabling dependency

Hi,

I have created a Gantt chart where each task have a predecessor as well as a start date and an end date. I am calculating the start and end dates based on certain criteria.
It works fine when I don't map the dependency property in task settings for the Gantt chart. But, when I provide the dependency field, the start date and end date which I have specified for the tasks gets ignored and the end date of previous task is set as start date for the current task.

Is it possible to display the dependency as well as have specific start date and end date for the tasks? If yes, it would be helpful if you guide me to do so.

Thanks


9 Replies

KR Karthikeyan Raja Syncfusion Team December 31, 2019 06:23 AM UTC

Hi Sanjay, 
Greetings from Syncfusion support. 
When predecessor is mapped, dates are validated based on the predecessor values. To disable the predecessor validation, we need to disable the property enablePredecessorValidation. Also in Gantt, we are validating the dates based on various properties such as dayWorkingTime, workWeek, includeWeekend, holidays. To show the date as given in the data source, we need to make 24 hours as working day by specifying the range as 0 to 24 and also we need to enable includeWeekend property to make the weekends also as working days. When duration field is mapped, end dates are calculated based on the start date and duration. To show the end date as same as the date given in the data source we should not map duration field. Please refer the below code snippet for this. 
 
[app.component.html] 
<ejs-gantt id="ganttDefault"  
         [dayWorkingTime]="dayWorkingTime" [includeWeekend]="true" [enablePredecessorValidation]="false"> 
</ejs-gantt> 
 
[app.component.ts] 
export class AppComponent { 
       //... 
    public dayWorkingTime: object; 
    public ngOnInit(): void { 
       //... 
       this.dayWorkingTime = [{ from: 0, to: 24 }]; 
    } 
} 
 
Please find the below sample link. 
Please get back to us if you require further assistance on this. 
 
Regards, 
Karthikeyan Raja. 



SR SR December 31, 2019 09:31 AM UTC

Hi,

Thank you for the prompt reply. Setting enablePredecessorValidation to false, did the trick. It is now working as expected.
Just wanted to highlight that, setting the predecessor to (-1) for any task, breaks the chart.

Much appreciated,
Sanjay


KR Karthikeyan Raja Syncfusion Team January 2, 2020 11:46 AM UTC

Hi Sanjay, 
 
In Gantt, predecessors render are calculated by task ID value and Task ID values should be whole numbers. Hence, make sure your data source value. 
Please let us know, if you need further assistance on this. 
 
Regards, 
Karthikeyan Raja. 



SR SR January 3, 2020 09:39 AM UTC

Okay. Now, one last issue, as you mentioned, I have set enablePredecessorValidation to false so that the start & end date which I have specified is respected. Now, the issue I am facing is, when I edit the task bar by dragging it, the predecessor is not validated. Is there a way to enable the validation only at that time?


JA Jesus Arockia Sankaran S Syncfusion Team January 7, 2020 01:24 PM UTC

Hi Sanjay, 
 
We have prepared the sample and enabled predecessor validation during taskbar drag action by using  ‘isInPredecessorValidation’ property in taskbarEditing and taskbarEdited client-side events. Please find the code snippet below, 
 
app.component.html] 
//… 
<ejs-gantt id="gantt" #gantt (taskbarEditing)="taskbarEditing($event)" (taskbarEdited)=" taskbarEdited($event)" </ejs-gantt> 
 
[app.component.ts] 
//… 
public taskbarEditing(args: any){ 
  if (args.taskBarEditAction == "ParentDrag" || args.taskBarEditAction == "ChildDrag") { 
        this.gantt.isInPredecessorValidation = true; 
  } 
} 
public taskbarEdited(args: any){ 
  if (args.taskBarEditAction == "ParentDrag" || args.taskBarEditAction == "ChildDrag") { 
      this.gantt.isInPredecessorValidation = false; 
   } 
} 
 
 
Please find the sample from below link, 
Please get back to us, If you need any further assistance on this. 
 
Regards, 
Jesus Arockia Sankaran S 



SR SR January 16, 2020 11:28 AM UTC

Hi,

I tried the workaround as you mentioned. It works fine while 
dragging the taskbar. However it does not work when I increase the duration of the task. Is there any event to handle that too?

Also, assume the following scenario:
Task B has FS dependency on Task A.
If I drag Task A and move it to a 
later date, Task B gets arranged automatically as expected.
But, if I drag Task B and move it to a date 
before Task A, it allows me to do so. Shouldn't Task B move to it's original position if it is moved to some date before Task A as it has FS dependency on Task A?

Thanks,
Sanjay


JA Jesus Arockia Sankaran S Syncfusion Team January 17, 2020 12:41 PM UTC

Hi Sanjay, 
 
Please find the below response. 
Query1 – Enabling Predecessor validation while resizing the taskbar 
Solution: We have prepared the sample and enabled predecessor validation during taskbar resize action by using  taskbarEditAction argument property in taskbarEditing and taskbarEdited client-side events. Please find the code snippet below,  
app.component.html]  
//…  
<ejs-gantt id="gantt" #gantt (taskbarEditing)="taskbarEditing($event)" (taskbarEdited)=" taskbarEdited($event)" </ejs-gantt>  
  
[app.component.ts]  
//…  
public taskbarEditing(argsany){  
  if (args.taskBarEditAction == "ParentDrag" || args.taskBarEditAction == "ChildDrag" ||  
args.taskBarEditAction == "RightResizing" || args.taskBarEditAction == "LeftResizing") {  
        this.gantt.isInPredecessorValidation = true;  
  }  
}  
public taskbarEdited(argsany){  
  if (args.taskBarEditAction == "ParentDrag" || args.taskBarEditAction == "ChildDrag" ||  
args.taskBarEditAction == "RightResizing" || args.taskBarEditAction == "LeftResizing") {  
      this.gantt.isInPredecessorValidation = false;  
   }  
}  
 
 
Please find the sample from below link,  
 
Query2 – Query about FS Dependency behavior 
Solution: In Gantt, When move the predecessor task based on the predecessor Type(FS) its successor tasks will validate but while move the successor task then its offset value will be update. The offset value is positive when its lead and it is negative when is lack. 
Please find the documentation link below, 
 
Please get back to us, If you need any further assistance on this. 
 
Regards, 
Jesus Arockia Sankaran S 



SR SR January 23, 2020 10:03 AM UTC

Hi. Thanks for the sample. We tried it out and it is now working as expected.

Thanks,
Sanjay


JA Jesus Arockia Sankaran S Syncfusion Team January 23, 2020 04:44 PM UTC

Hi Sanjay, 
  
Thanks for your update. 
  
Regards, 
Jesus Arockia Sankaran S 


Loader.
Live Chat Icon For mobile
Up arrow icon