- Home
- Forum
- React - EJ 2
- Set non-zero offset for a dependency to avoid moving tasks?
Set non-zero offset for a dependency to avoid moving tasks?
Hi,
Currently when say a FS dependency is added, the second task gets moved so that it start day matches that of the first task's end date. This is because the dependency laf is 0 by default, as far as I understand. We would like to avoid moving tasks when adding dependencies. Is it possible to set the initial offset so that the tasks would retail their position?
Thanks.
SIGN IN To post a reply.
6 Replies
PP
Pooja Priya Krishna Moorthy
Syncfusion Team
May 27, 2020 05:54 AM UTC
Hi Dmitry,
Yes, it is possible to prevent validation of start date and end date of taskbar while adding dependency. This can be done by disabling the property enablePredecessorValidation. Please find the below code example.
|
<GanttComponent id='Editing'
//...
enablePredecessorValidation ={false}>
</GanttComponent> |
Please find the below sample link.
Regards,
Pooja K.
DV
Dmitry Vorobyev
May 27, 2020 06:22 AM UTC
Thank you so much! We are really excited about your components!
BTW, what is the correct way of purchasing and applying a license (if any)?
Thanks!
DV
Dmitry Vorobyev
May 27, 2020 06:55 AM UTC
Sorry - yet another dependencies related question.
Is it possible to limit task connections to only subtasks belonging to the same parent (job)? I can validate the connection in the event handler, but on the Dependency task there is a list of all tasks anyway. Can we limit possible tasks to connect to to be the siblings of the current tasks only?
Thanks in advance!
LG
Logeswari Gopalakrishnan
Syncfusion Team
May 28, 2020 02:00 PM UTC
Hi Dmitry,
We have analyzed your query and achieved your requirement to prevent dependency connection of same parent task on editing actions using actionBegin and actionComplete event . Please find the below code snippet.
|
<GanttComponent id='Editing' ref={gantt =>this.ganttInstance = gantt}
actionBegin={this.actionBeginEvent.bind(this)} actionComplete={this.actionCompleteEvent.bind(this)}>
<Inject services={[Edit, Selection, Toolbar, DayMarkers]} />
</GanttComponent>
…///
this.actionBeginEvent = function(args) {
if (args.columnName === "Predecessor" && args.type === "save") {
var from = + args.value[0];
var to = args.rowData.TaskID;
var fromRecord = this.ganttInstance.getRecordByID(from);
if (fromRecord.parentItem.taskId === args.rowData.parentItem.taskId) {
args.cancel = true;
}
this.ganttInstance.treeGrid.endEdit();
}
else if (args.requestType === "ValidateDependency") {
var fromTask = this.ganttInstance.getRecordByID(args.fromItem.taskId);
var toTask = this.ganttInstance.getRecordByID(args.toItem.taskId);
if (fromTask.parentItem.taskId === toTask.parentItem.taskId) {
args.isValidLink = false;
}
}
};
this.actionCompleteEvent = function (args) {
if ((args.action == "DialogEditing" && args.requestType == "save")) {
var from= + args.data.Predecessor[0];
var to = args.data.TaskID;
var fromRecord = this.ganttInstance.getRecordByID(from);
if (fromRecord.parentItem.taskId === args.data.parentItem.taskId) {
this.ganttInstance.removePredecessor(args.data.TaskID);
}
}
}
|
Please find the below sample link.
Please let us know if you need further details on this.
Regards,
Logeswari G
DV
Dmitry Vorobyev
May 28, 2020 03:46 PM UTC
Sorry but your code doesn't work.
1. If you want to allow to connect only tasks belonging to the same parent, you should replace the === operator with !== everywhere.
2. Your code fails with error when adding dependencies to a newly created task.
3. Your code doesn't limit the tasks on the Dependency tab to current task's siblings. Instead, it cancels an invalid dependency on save. This is a quite misleading UX. Can we filter the tasks listed on the Dependency tab?
4. Are you sure that task id is always 1-digit?
var from = +e.data.Predecessor[0];
LG
Logeswari Gopalakrishnan
Syncfusion Team
May 30, 2020 08:29 AM UTC
Hi Dmitry,
Please find the below response.
|
S.No |
Queries |
Syncfusion Comments | |
|
1.
|
If you want to allow to connect only tasks belonging to the same parent, you should replace the === operator with !== everywhere. |
Sorry for the inconvenience caused. We misunderstand the query. That’s why we achieved to allow to connect tasks not belonging to the same parent. | |
|
2. |
Your code fails with error when adding dependencies to a newly created task.
|
We can limit the dependency collections in dialog (both add and edit )using actionComplete event. Please find the below code snippet.
Note: In this sample we added newly record as Child.
| |
|
3. |
Your code doesn't limit the tasks on the Dependency tab to current task's siblings. Instead, it cancels an invalid dependency on save. This is a quite misleading UX. Can we filter the tasks listed on the Dependency tab? | ||
|
4. |
Are you sure that task id is always 1-digit? |
To handle 2 digit value and more than one predecessor value , we can use split and match operator. Please find the below code snippet.
|
We have prepared sample for this. Please find the below sample link.
Please let us know if you need further details on this.
Regards,
Logeswari G
SIGN IN To post a reply.
- 6 Replies
- 3 Participants
-
DV Dmitry Vorobyev
- May 26, 2020 07:34 PM UTC
- May 30, 2020 08:29 AM UTC