axapta - 加载表单时更新甘特图中的 View 范围

标签 axapta x++ dynamics-365-operations

我正在尝试使用 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/

相关文章:

reporting-services - 尝试打印任何报告时出现错误 "An error occurred during report data sets execution"

c# - 如何通过 C# 连接到 Azure D365 Odata

axapta - 表更新事件处理程序

x++ - 使用 Axapta 报告工具在同一行上打印不同表中的列的最佳方法是什么?

c# - 如何解决使用 Visual Studio 将 C# 项目部署到 AX 2012 时出现的错误?

axapta - Dynamics AX x++ 无法关闭第一个表单

reporting-services - x++ 从 recid 获取资源名称

axapta - D365FO 中的命令链(方法包装)结果为 'Object is not set to an instance of an object'

axapta - 删除字符串 AX 2012 中的所有空格

dynamics-ax-2009 - X++ 或 Dynamics AX 中的 .toString() 变体是什么?