Schedule Task Which is Dependent Another Task Not Working As I Expected

Hello, I am working with Gantt component. In the picture below I schedule all task by using Schedule button and I set start date as 13/09/2024 and I use Next Day button, all operations datas are setted 14/09/2024 its true but the task data which is depentent one is setted 15/09/2024 its wrong. 

If third and forth data is dependent to previous task the they are also setted wrong date. third one is setted as 16/09/2024 last one would be 17/09/2024. But I want to see all data as 14/09/2024.

What should I do? What is the working principle of the gantt? Can we change it? Thanks.


8 Replies

SJ Sridharan Jayabalan Syncfusion Team September 10, 2024 11:23 AM UTC

Hi Emrah,

 

Greetings from Syncfusion!

 

Thank you for reaching out with your query regarding the Gantt component.

 

To clarify, the behavior you're seeing—where tasks after "14/09/2024" are scheduled for later dates—is due to the Gantt Chart's dependency validation. This is the expected behavior when dependencies are defined between tasks. However, if you'd like the tasks to follow the exact start dates provided in the data source without dependency-based adjustments, we recommend using the autoCalculateDateScheduling API.

 

Code-Snippet:   

<GanttComponent 

       autoCalculateDateScheduling={false} >

 

You can see the adjusted behavior by clicking the "Change startDate" button in the sample provided below. Keep in mind, with this API enabled, the Gantt chart will display tasks exactly as they are in the data source, without considering task dependencies.

 

Sample - Q4smj2 (forked) - StackBlitz

Documentation - Task dependency in React Gantt component | Syncfusion

 

If we misunderstood your query, share more details like Screenshot/ Code example that you have performed on button click to proceed further.

 

Note: - We are unable to find the attachment that you have shared.


 

Best regards,
Sridharan



EA Emrah Asma replied to Sridharan Jayabalan September 17, 2024 11:57 AM UTC

Hi, the problem is when I schedule the parent note by clicking next date, the task's dates are setted as in the below. I expect to see all dates are 22/09/2024 but dates are setted like 22, 23, 24, 25. I dont want it. I think its a Gantt behavior

Image_4201_1726573857226


<GanttComponent 

       autoCalculateDateScheduling={false} > this is a not solution for me.


Thank you.



SJ Sridharan Jayabalan Syncfusion Team September 18, 2024 01:03 PM UTC

Hi Emrah,

 

For your query, we recommend using the enablePredecessorValidation API and setting it to false to prevent the dependency validation. This will meet your requirement. After doing this, changing the parent task’s start date will update all child tasks to the same date. Please refer to the code snippet below:

 

 

enablePredecessorValidation={false}

 

Modified Sample - Q4smj2 (forked) - StackBlitz

 

 

Regards,

Sridharan



EA Emrah Asma replied to Sridharan Jayabalan September 18, 2024 01:48 PM UTC

Hi, 

I applied your solution then the dates are same but time not calculated properly. I show the expected time with yellow text in the below.

Image_3274_1726667065861


 <GanttComponent
                  id='cloud-scheduler-gantt'
                  dataSource={this.state.GantData}
                  enablePredecessorValidation={false}
                  ref={(gant: GanttComponent) => (this.gantObj = gant)}
                  dateFormat='dd/MM/yyyy HH:mm'
                  durationUnit='Hour'
                  actionComplete={this.actionCompletedElement.bind(this)}
                  actionBegin={this.actionBegin.bind(this)}
                  dataBound={this.dataBound.bind(this)}
                  treeColumnIndex={4}
                  contextMenuItems={this.contextMenuItems}
                  contextMenuOpen={this.contextMenuOpen.bind(this)}
                  contextMenuClick={this.contextMenuClick.bind(this)}
                  showColumnMenu={true}
                  taskType='FixedWork'
                  width={'100%'}
                  taskbarEditing={this.taskbarEditing.bind(this)}
                  allowFiltering={true}
                  selectionSettings={{
                    type: 'Multiple',
                    mode: 'Row',
                    enableToggle: true,
                  }}
                  allowSorting={true}
                  connectorLineBackground='red'
                  allowResizing={true}
                  workWeek={[
                    'Monday',
                    'Tuesday',
                    'Wednesday',
                    'Thursday',
                    'Friday',
                    'Saturday',
                    'Sunday',
                  ]}
                  toolbarClick={this.toolbarClick.bind(this)}
                  editDialogFields={this.editDialogFields}
                  projectStartDate={this.state.projectStartDate}
                  projectEndDate={this.state.projectEndDate}
                  allowRowDragAndDrop={false}
                  queryCellInfo={this.gantCellQuery.bind(this)}
                  rowSelected={this.rowSelected}
                  rowDeselected={this.rowDeselected}
                  taskFields={{
                    id: 'TaskID',
                    name: 'TaskName',
                    startDate: 'StartDate',
                    endDate: 'EndDate',
                    duration: 'Duration',
                    progress: 'Progress',
                    dependency: 'Predecessor',
                    child: 'subtasks',
                    notes: 'info',
                    resourceInfo: 'Resources',
                    segments: 'Segments',
                    work: 'Work',
                  }}
                  timelineSettings={this.timelineSettings}
                  labelSettings={this.labelSettings}
                  editSettings={
                    this.state.current_plan_isLocked
                      ? undefined
                      : this.editSettings
                  }
                  height={
                    this.state.status
                      ? 'calc(-130px + 70vh)'
                      : 'calc(-130px + 100vh)'
                  }
                  gridLines={'Both'}
                  toolbar={
                    this.props.isSuperVisor ? this.toolbarAdmin : this.toolbar
                  }
                  resourceFields={this.resourceFields}
                  resources={this.state.resourceData}
                  enableContextMenu={true}
                  filterSettings={{ type: 'Menu' }}
                  allowExcelExport={true}
                  allowPdfExport={true}
                  allowReordering={true}
                  highlightWeekends={true}
                  enableVirtualization={false}
                  splitterSettings={{
                    columnIndex: 2,
                    position: '60%',
                  }}
                  dayWorkingTime={this.state.dayWorkingTime}
                  timezone={Intl.DateTimeFormat().resolvedOptions().timeZone}
                >
                  <ColumnsDirective>
                    {columns.map((el: any) => {
                      return (
                        <ColumnDirective
                          key={el.field}
                          field={el.field}
                          headerText={el.headerText}
                          width={el.width}
                          visible={el.visible}
                          editType={el.editType}
                          edit={el.edit}
                          type={el.type}
                          format={el.format}
                          allowEditing={el.allowEditing}
                          displayAsCheckBox={el.displayAsCheckBox}
                          template={el.template}
                        />
                      );
                    })}
                  </ColumnsDirective>
                  <EditDialogFieldsDirective>
                    {editDialogFields.map((el) => {
                      return (
                        <EditDialogFieldDirective
                          key={el.type}
                          type={el.type as any}
                          headerText={el.headerText}
                        />
                      );
                    })}
                  </EditDialogFieldsDirective>
                  <Inject
                    services={[
                      Edit,
                      Selection,
                      Toolbar,
                      DayMarkers,
                      CriticalPath,
                      Resize,
                      ColumnChooser,
                      Filter,
                      ContextMenu,
                      ColumnMenu,
                      VirtualScroll,
                      ExcelExport,
                      PdfExport,
                      Sort,
                      Reorder,
                    ]}
                  />
                </GanttComponent>


What should I do? I still think the feature is related with the gantt component becasue I didnt play with the data to change dates.


Thank you.



EA Emrah Asma September 19, 2024 08:13 AM UTC

Hi,

When I add this code in the below, dates are being calculeted as expected but now I see a spinner and the spinner doesnt dissappear. It seems a solution but I think I use this in a wrong way because I see spinner all the time.

 private actionBegin(args: any) {

      if (args.requestType == "validateLinkedTask") {
          args.validateMode.respectLink = true;
      }


I still dont understand why dates are setted wrong before I do that. Thank you. 



SJ Sridharan Jayabalan Syncfusion Team September 19, 2024 01:22 PM UTC

Emrah,

 

For your query, kindly ignore all our previous updates suggested. Now you can simply add time to your startDate in the datasource which will work as you expected. change the parent's start date and ensure does the solution meet your requirement. Refer code snippet for your reference. 

 

Code-Snippet:   

data.js:-

{        TaskID: 2,
        TaskName: 'Identify site location',
        StartDate: new Date('04/02/2024 08:00:00'),
        Duration: 1,
        Progress: 30,
        resources: [1],
        info: 'Measure the total property area alloted for construction',
  },

index.js:-

  <GanttComponent
     dateFormat={'MMM dd, y ,hh,mm'}
  >

 

Modified Sample - https://stackblitz.com/edit/react-uvxq74-adtjha?file=index.js,data.js

 

 

 

Regards,

Sridharan



EA Emrah Asma replied to Sridharan Jayabalan September 20, 2024 06:27 AM UTC

Hi, it doesnt work for me. I record a video. https://youtu.be/f4TwQh9hpwE

Maybe there is a unit inconsistency in the gantt, we usually use Hour Unit. Hope the video is usefull to investigate the issue. I shared my gantt before, if you want to see any part of the code I will share it,

Thank yo



PR Padmini Ramamurthy Syncfusion Team September 23, 2024 08:04 PM UTC

Emrah,


Based on your shared details, we tried to replicate the issue but were unable to reproduce it. We have prepared a sample using updateRecordById method to update the start date of the parent task with external button click, and the issue did not occur.

To assist you further, please provide the following details:

  1. Confirm the version of the Gantt chart you are using.
  2. Share the complete Gantt chart code.
  3. Provide details about the "Next Day" button, specifically how you are updating the start date through that button.
  4. Share any customizations made using events such as actionComplete, dataBound, etc.
  5. Provide the time zone details you are working with.

Sample - https://stackblitz.com/edit/react-uvxq74-3yskye?file=index.js



Loader.
Up arrow icon