加载表单时更新甘特图中的视图范围

问题描述 投票:2回答:1

我正在尝试在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(); 

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

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

处理甘特时有什么我想念的吗?

axapta x++ dynamics-365-operations
1个回答
2
投票

由于某种原因,GanttControl不允许在初始化之后通过调用直接更改

ganttControl.parmConfiguration().parmFromDateTime(foo);

相反,您需要首先创建一个GanttControlConfiguration对象。以下代码解决了这个问题:

GanttControlConfiguration configuration = ganttControl.parmConfiguration();
configuration.parmAllowMultiChange(true);
configuration.parmFromDateTime(foo);
configuration.parmToDateTime(bar);
ganttControl.parmConfiguration(configuration);
© www.soinside.com 2019 - 2024. All rights reserved.