Views that support grouping: Timetable / Week Range / List / Resource. The Resource view can only operate when grouping is enabled. The other views do not support grouping.
In order to enable grouping the following steps should be done:
The following code illustrates how to enable grouping by contacts:
C# Copy Code |
---|
// Define two contacts to group by |
Visual Basic Copy Code |
---|
' Define two contacts to group by |
The text displayed in the header of the corresponding resource depends on the type of the resource and is as follows:
The Resource view allows grouping by two resource types simultaneously. The primary resource type is still specified through the GroupType property. The secondary resource type is specified through the SecondaryGroupType property. When multiple grouping is enabled the view is divided by the primary resources first. Then each primary resource is additionally subdivided by all secondary resources. For example, if there are two primary resources and three secondary resources specified, the view will display two main headers, divided by three subheaders each, for a total of six rows.
Usually the GroupType and SecondaryGroupType properties are set to different values. For example, GroupType can be set to GroupByContacts and SecondaryGroupType can be set to GroupByResources, to group by contacts and resources respectively. However, it is possible to group resources by their runtime type. In this case both the primary and the secondary resources need to be placed in the Calendar.Resources collection and both GroupType and SecondaryGroupType need to be set to GroupByResources. In addition, CustomGroupType and CustomSecondaryGroupType must be set to the appropriate runtime type of the resources. The following example illustrates how to enable grouping by custom resources of type Machine and Worker:
C# Copy Code |
---|
calendar.GroupType = GroupType.GroupByResources; |
Visual Basic Copy Code |
---|
calendar.GroupType = GroupType.GroupByResources |
It might not always be desired that a primary resource is associated with all secondary resources. In the above case for example, only a subset of the workers could be associated with a machine. This can achieved in MindFusion.Scheduling through the CustomizeGrouping event. Let us assume that the Machine class provides a list of workers that are qualified to work with that machine. In this case, the following CustomizeGrouping event handler enables grouping only by the qualified workers:
C# Copy Code |
---|
private void OnCustomizeGrouping(object sender, CustomizeGroupingEventArgs e) |
Visual Basic Copy Code |
---|
Private Sub OnCustomizeGrouping(ByVal sender As Object, ByVal e As CustomizeGroupingEventArgs) |