我正在尝试在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();
由于某些原因,甘特图仅适应于加载表单时所选约会的视图更改。 通过更改选择进行任何其他更改视图范围的尝试均将失败,并且甘特图不会以任何方式对更改做出反应。
将甘特图移动到单独的窗体时,将按预期的初始化设置视图范围。
在处理尖头玩具时我有什么想念的吗?
答案 0 :(得分:2)
由于某些原因,GanttControl不允许在初始化后通过调用直接更改
ganttControl.parmConfiguration().parmFromDateTime(foo);
相反,您需要首先创建GanttControlConfiguration对象。 以下代码解决了该问题:
GanttControlConfiguration configuration = ganttControl.parmConfiguration();
configuration.parmAllowMultiChange(true);
configuration.parmFromDateTime(foo);
configuration.parmToDateTime(bar);
ganttControl.parmConfiguration(configuration);