2

我正在尝试在 D365 FO 中使用甘特图控件来可视化房间中的约会。因此,房间作为摘要加载,约会作为活动链接到房间。

用户能够从网格中选择约会。发生这种情况时,应将视图范围更改为显示区间 [begin-12, end+12],并将约会及其房间添加到甘特图中。

代码看起来有点像:

// changes FromDateTime, ToDateTime in gantt control
this.setViewRange(); 

// adds rooms and appointments to a list
// and adds them to the gantt by calling parmActivities(theList) on the gantt control
this.addAppointments();

// standard method to refresh the gantt
ganttControl.refresh(); 

出于某种原因,甘特图只适应加载表单时所选约会的视图更改。通过更改选择来更改视图范围的任何进一步尝试都会失败,并且甘特图不会以任何方式对更改做出反应。

将甘特图移动到单独的表单时,视图范围将按预期进行初始化。

处理甘特图时我有什么遗漏吗?

4

1 回答 1

2

For some reason, the GanttControl does not allow to be changed directly after initialization by calling

ganttControl.parmConfiguration().parmFromDateTime(foo);

Instead you need to create a GanttControlConfiguration object first. The following code solves the problem:

GanttControlConfiguration configuration = ganttControl.parmConfiguration();
configuration.parmAllowMultiChange(true);
configuration.parmFromDateTime(foo);
configuration.parmToDateTime(bar);
ganttControl.parmConfiguration(configuration);
于 2018-08-29T15:29:45.670 回答