Our state of the art Gantt chart


Post by alex.l »

Hi,

Any reasons you set constraintDate and startDate in the same dataSource field? This might be the reason - constraintDate updates startDate which recalculates constraints, which triggers startDate update. Please try to fix that and see if problem reproducible.

All the best,
Alex


Post by jintech »

The reason for setting both the start_date and constraintDate field to have the same dataSource is because when we load the page, the tasks and projects date should automatically adjust based on the start date constraint. What I want is that a child task cannot start earlier than the parent project start date. Also when creating new child tasks, we should apply this constraint to newly added tasks so that a user cannot create a task before the parent item start date.

Should I pass a separate variable from the server side having the same start_date value and set it in dataSource for constraintDate or remove this field completely? If I remove this field, what impact will it have on my current implementation?


Post by alex.l »

Hi,

constraintDate will already affect on event and set startDate as you want, that's why we need constraints. You can learn more details about constraints here https://bryntum.com/products/gantt/docs/guide/engine/gantt_events_scheduling#event-constraint-effect-on-the-scheduling
If you need that hook, better to do it data level, because model level could make loops in updates.
If you remove constraint, an event will be scheduled accordingly, so yes, it will get impact on you implementation.
You solution more sounds like you just need to pass startDate, remove constraint, and set manuallyScheduled: true and it will do that you want. https://bryntum.com/products/gantt/docs/guide/engine/gantt_events_scheduling#manually-scheduled-events

All the best,
Alex


Post by jintech »

Removing the constraintDate and constraintType and setting manually scheduled to true causes issues.

My desired behavior should be the following.

  1. For an item having no parent:
    • If I move this item backward or forward, the start and end date should get updated
      - If I have any child items under that parent item, they should move and readjust the start and end date accordingly
    • At this point, an event should be triggered so that all the items whose start and end dates have been updated can be handled
      and sent to the server to update on database.
  2. For an item having a parent:
    • If I move this item backward or forward, the start and end date should get updated
      - If I have any child items under that parent item, they should move and readjust the start and end date accordingly.
      - If the item is moved beyond the parent item's end date or before the parent item's start date, the parent item should get
      updated accordingly to accommodate the change
      - The parent items should adjust according to and get their start and end dates updated accordingly
    • At this point, an event should be triggered so that all the items whose start and end dates have been updated can be handled
      and sent to the server to update on database.

How can I achieve this behavior while also preventing the uncaught error from appearing?


Post by alex.l »

Hi,

To prevent error from appearing, try to remove mapping two fields to one source.
To get such behaviour you need to add constraints, as far as I got the idea. You need to set startDate and constraintDate to same value before you loaded it into project, as example on your backend. Try this, it should fix the problem with the loop and give you desired behaviour. Does that possible for you?

All the best,
Alex


Post by jintech »

The above suggestion did not work and the error was still appearing.
However, deleting the effective duration field from the item before passing it to json.stringify fumction resolved the issue

delete item.effectiveDirection;
JSON.stringify(item)

Post by alex.l »

Hi,

Well, now I do not have a theory why it might happen. We already have TaskModel you used, could you please share test data as well, so we will be able to reproduce the problem and investigate it? That sounds like a bug and we want to investigate reasons.

Thanks!

All the best,
Alex


Post Reply