|
<GanttComponent id='Editing'
//...
enablePredecessorValidation ={false}>
</GanttComponent> |
|
<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);
}
}
}
|
|
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.
|