Often, you might have a data source with EndTime field rather than an Effort field for a task.
In such cases, you have to first setup EffortBinding using a converter as follows:
|
var effortConverter = { Convert: function (value, parameter) { var task = parameter; return effortConverter.GetTaskEffort(task); }, ConvertBack: function (value, parameter) { // Compute EndTime based on StartTime and Effort. var duration = value; var task = parameter; // Note that "WorkTimeSchedule.Schedule8X5" is the same schdule used by the GanttControl // in this app. If you use a different schedule in the GanttControl, use that same schedule here as well: return RadiantQ.Gantt.WorkTimeSchedule.Schedule8X5.GetEnd(task.StartTime, duration); }, GetTaskEffort: function (task) { // Note that "WorkTimeSchedule.Schedule8X5" is the same schdule used by the GanttControl // in this app. If you use a different schedule in the GanttControl, use that same schedule here as well: if (task.StartTime && task.EndTime) { if (task.StartTime && task.EndTime) return RadiantQ.Gantt.WorkTimeSchedule.Schedule8X5.GetEffort(task.StartTime, task.EndTime); } return RQTimeSpan.Zero; } }; $gantt_container.GanttControl({ ..................... ...... EffortBinding: new RadiantQ.BindingOptions("EndTime", RadiantQ.Gantt.BindingMode.TwoWay, new effortConverter()), EndTimeBinding: new RadiantQ.BindingOptions("EndTime"), .............. .... }); |
Also see how you will have to setup the EndTimeBinding so that changes made to the EndTime are persisted back into your data's EndTime property.
This is also illustrated in this sample that's part of our install: <install path>\Samples\GanttControlBindingToEndTime.htm
(The above sample also sets the AdjustDurationOnAssignment property to false to make the gantt work in "Fixed Duration" mode. You can choose to keep it true to make the gantt adjust the duration of a task when multiple assignments are made.)
© RadiantQ 2022. All Rights Reserved.