2

I'm trying to use a gantt control in D365 FO as a way to visualize appointments in rooms. Therefore, the rooms are loaded as summaries and the appointments are linked as activities to the rooms.

The user is able to select an appointment from a grid. As this happens, the view range shall be changed to show the interval [begin-12, end+12] and the appointments together with their rooms shall be added to the gantt.

The code looks somewhat like that:

// 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(); 

For some reason, the gantt does only adapt to the view changes for the appointment selected when the form is loaded. Any further attempts to change the view range by changing the selection fail and the gantt does not react in any way to the change.

When moving the gantt to a separate form the view range is set as expected for initialization.

Is there anything I'm missing when dealing with gantts?

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
Linus Wagner
  • 151
  • 1
  • 1
  • 8

1 Answers1

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);
Linus Wagner
  • 151
  • 1
  • 1
  • 8