Groups class (Schedule)

Groups(oSchedule)

new Groups(oSchedule)

The Groups object holds a collection of Group type (group of the control). Use the Schedule.Groups property to access the control's groups collection. The control can split the schedule into multiple groups (columns) to display events. Each group has its own header and can be associated with a specific resource, category, ... The groups are identified by their identifier (GroupOptions.id field). The Event.GroupID property indicates the identifier of the group that event belongs to. You can use the Schedule.Group(id) method to get a specific group giving its identifier, index or reference. The Add() method creates and adds a new group into the control. The Remove() method removes a group from the control giving its identifier, index or reference. The Count property returns the number of groups within the collection. The Clear() method removes all groups of the control.

The control displays groups if:

  • ShowGroupingEvents property is true
  • at least a visible group is defined into the control (at least a group is added into the control's groups collection)
Parameters:
Name Type Description
oSchedule Schedule Indicates an object of Schedule type that owns the collection.

Members

(readonly) Count :number

The Count property returns the number of groups within the collection. The Add, Remove and Clear methods change the number of groups within the collection. The Item() and Count property can be used to enumerate the groups within the collection. The Event.GroupID property indicates the identifier of the group that event belongs to. The Schedule.Group(id) method returns the group based on its index or identifier.
Type:
  • number
Example
The following statements are equivalents:

 oSchedule.Group.Count, counts the groups within the control
 oSchedule.Group.GetCount(), counts the groups within the control

where oSchedule is an object of Schedule type
Count

Methods

Add(oGroupOptsopt) → {Group}

The Add() method creates and adds a new group into the control. The ShowGroupingEvents property specifies whether the schedule view shows grouped events. The Event.GroupID property defines the identifier of the group that event belongs to. The GroupOptios.id field specifies the identifier of the group. You can use the Schedule.Group(id) method to get a specific group giving its identifier, index or reference. The Remove() method removes a group from the control giving its identifier, index or reference. The Count property returns the number of groups within the collection. The Clear() method removes all groups of the control.

The control displays groups if:

  • showGroupingEvents field is true
  • The Groups collection has visible elements. By default, the Groups collection contains no Group objects
Parameters:
Name Type Attributes Description
oGroupOpts any <optional>
Specifies the options to create the new group, as an object of GroupOptions type, else it defines the identifier of the group (the group's header displays its caption).
Returns:
Returns the newly created group, as an object of Group type
Type
Group
Example
oSchedule.Groups.Add("G1"), adds a new group with the identifier "G1"
oSchedule.Groups.Add({id: "G1"}), adds a new group named "G1"
Add

Clear()

The Clear() method removes all groups of the control. The Schedule.Clear() method clears the events, groups and mark-zones. The Remove() method removes a group from the collection. The Group.Remove() method removes the group itself from the collection. The Schedule.Group(id) method returns the group based on its index or identifier (equivalent of this method). The Count property returns the number of groups within the collection. The Add, Remove and Clear methods updates the groups collection. The Item() method returns null if the group is not found, or an object of Group type, if the groups collection contains the giving id. You can use the Item and Count property to enumerate the groups within the collection. The Event.GroupID property defines the identifier of the group that event belongs to.
Example
oSchedule.Groups.Clear(), removes all groups of the control
Clear

Item(id) → {null|Group}

The Item() method gets the group giving its index, identifier or reference. The Schedule.Group(id) method returns the group based on its index or identifier (equivalent of this method). The Count property returns the number of groups within the collection. The Add, Remove and Clear methods updates the groups collection. The Item() method returns null if the group is not found, or an object of Group type, if the groups collection contains the giving id. You can use the Item and Count property to enumerate the groups within the collection.
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the group to request
  • id {string}, specifies a string expression that defines the identifier of the group to request
  • id {Group}, specifies the object reference to the group to request for
Returns:
Returns null if the group is not found, or an object of Group type, if the groups collection contains the giving id.
Type
null | Group
Example
The following statements are equivalents:

 oSchedule.Groups.forEach(function(oGroup, index)
 {
  console.log(oGroup.ID);
 })

or

 for ( var i = 0; i &lt; oSchedule.Groups.Count; i++ )
  console.log(oSchedule.Groups.Item(i).ID);

where oSchedule is an object of Schedule type
Item

Remove(id)

The Remove() method removes a group from the collection. The Group.Remove() method removes the group itself from the collection. Removing a group does not remove the events associated with that group. The Event.GroupID property defines the identifier of the group that event belongs to. The Group.Visible property shows or hides the group. The Schedule.Group(id) method returns the group based on its index or identifier (equivalent of this method). The Count property returns the number of groups within the collection. The Add, Remove and Clear methods updates the groups collection. The Item() method returns null if the group is not found, or an object of Group type, if the groups collection contains the giving id. You can use the Item and Count property to enumerate the groups within the collection.
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the group to request
  • id {string}, specifies a string expression that defines the identifier of the group to request
  • id {Group}, specifies the object reference to the group to request for
Example
The following statements are equivalents:

 oSchedule.Groups.Remove("G1"), removes the group with the identifier "G1"
 oSchedule.Group("G1").Remove(), removes the group with the identifier "G1"

where oSchedule is an object of Schedule type
Remove

RemoveRange(range) → {number}

The RemoveRange() method removes multiple-groups at once. The Group.Remove() method removes the group itself from the collection. The Schedule.Group(id) method returns the group based on its index or identifier (equivalent of this method). The Count property returns the number of groups within the collection. The Add, Remove and Clear methods updates the groups collection. The Item() method returns null if the group is not found, or an object of Group type, if the groups collection contains the giving id. You can use the Item and Count property to enumerate the groups within the collection. The Event.GroupID property defines the identifier of the group that event belongs to.
Parameters:
Name Type Description
range any Indicates a group, an array [{Group}], or an exontrol.Arr([{Group}]).
Returns:
Returns the number of groups being deleted
Type
number
Example
oSchedule.Groups.RemoveRange(["G1", "G2"]), removes the groups with the identifiers "G1" and "G2"
RemoveRange

cID() → {string}

The cID() method (short for createID) gets the identifier of the owner-group once the user creates a new event by drag and drop. The cID() method is called only if the control displays All events not grouped. You can override the cID() method to specify the event's group when it is created by drag and drop. By default, the cID() method returns the identifier of the first group.
Returns:
Returns the identifier of the group.
Type
string
Example
The following example indicates that any new event to create by drag and drop will be owned by "G2" group (the group with the ID on "G2"):

oSchedule.Groups.cID = function()
{
  return "G2"
}

where oSchedule is an object of Schedule type
cID