我正在尝试使用 D365 FO 中的甘特图控件来可视化房间中的约会。 因此,房间作为摘要加载,约会作为事件链接到房间。
用户可以从网格中选择约会。 发生这种情况时, View 范围应更改为显示间隔 [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();
由于某种原因,甘特图仅适应加载表单时所选约会的 View 更改。 任何通过更改选择来更改 View 范围的进一步尝试都会失败,并且甘特图不会以任何方式对更改使用react。
将甘特图移动到单独的表单时, View 范围将按初始化的预期设置。
处理甘特图时我遗漏了什么吗?
最佳答案
由于某种原因,GanttControl 不允许在初始化后通过调用直接更改
ganttControl.parmConfiguration().parmFromDateTime(foo);
相反,您需要首先创建一个 GanttControlConfiguration 对象。 下面的代码解决了这个问题:
GanttControlConfiguration configuration = ganttControl.parmConfiguration();
configuration.parmAllowMultiChange(true);
configuration.parmFromDateTime(foo);
configuration.parmToDateTime(bar);
ganttControl.parmConfiguration(configuration);
关于axapta - 加载表单时更新甘特图中的 View 范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52080063/