Class: Link

Link(oLinks, oLinkOptsopt)

The Link object holds information(options) about a link within the control. The Add(oLinkOpts) method creates and adds a link between two bars. The Item(id) method gets the link giving its index, identifier/key or reference.

Every option of the LinkOptions type has associated a property of the Link object. For instance, the option:

caption {string}, defines the link's caption
is associated with the property:
Caption {string}, defines the link's caption
which means that the following statements are equivalent:
oLink.Options = {caption: "link"}
oLink.SetOptions({caption: "link"})
oLink.Caption = "link"
oLink.SetCaption("link")
where oLink is an object of Link type
Parameters:
Name Type Attributes Description
oLinks Links Indicates an object of Links type that's the owner collection of this link
oLinkOpts object <optional>
Specifies the options to create the link as an object of LinkOptions type

Methods

GetCaption() → {string}

The GetCaption() method returns the link's caption
Returns:
Returns link's exHTML caption
Type
string

GetFrom() → {number|string|ItemBar}

The GetFrom() method indicates the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link starts from (in-item-bar).
Returns:
Returns the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link starts from (in-item-bar), as one of the following:
  • from {number}, indicates a numeric value that defines the index of the item (single/first item-bar of the item)
  • from {string}, specifies a string expression that defines the identifier/key of the item (single/first item-bar of the item)
  • from {ItemBar}, specifies the object reference to the item-bar
Type
number | string | ItemBar

GetIndex() → {any}

The GetIndex() method retrieves the link's index.
Returns:
Returns the link's index (0-based)
Type
any
Example
The following statements are equivalents:

 oLink.GetIndex(), returns the index of the link
 oLink.Index, returns the index of the link

where oLink is an object of Link type

GetKey() → {string}

The GetKey() method returns the link's key.
Returns:
Returns the link's key
Type
string

GetLag() → {number}

The GetLag() method returns the link's lag (specifies the delay (in days) between linked-activities during the Items.SchedulePDM() method)
Returns:
Returns link's lag
Type
number
The GetLink() method gets the appearance of the link between item-bars.
Returns:
Returns the appearance of the link between item-bars, as an object of {type, dir, width, color, arrow, style, startPos, endPos} type, where:
  • type {exontrol.LinkTypeEnum}, specifies the type of the link as 0 (rectangular), 1 (direct), 2(straight) or 3(round)
  • dir {number}, specifies whether the link's direction is shown or hidden as 0 (hidden), 1(shows the direction/arrow where the link begins), 2(shows the direction where the link ends, default) or 3 shows the arrows in both sides
  • width {number}, specifies the link's width or size (1 by default)
  • color {string}, indicates the link's color (partial-black by default)
  • arrow {string}, indicates the arrow's color. If it is missing or not specified the arrow is shown using the link's color (gray by default)
  • arrowSize {number}, indicates the arrow's size. If it is missing or not specified the arrow's size is defined by link's width (1 by default) (since 2.2)
  • arrowShape {object}, defines an object of exontrol.Def.Shape type to customize the shape of the link's arrow (for instance shows the link's arrow as a circle instead of a triangle) (since 2.2)
  • style {array}, specifies the link's dash pattern to show the lines (solid by default)
  • startPos {any}, indicates the list of corners of in-element, the link can start from
  • endPos {any}, indicates the list of corners of out-element, the link can end to
Type
DisplayLinkType

GetOptions() → {object}

The GetOptions() method returns the link's options at once
Returns:
Returns an object of LinkOptions type
Type
object
Example
The following statements are equivalents:

 oLink.GetOptions(), returns the options of the link
 oLink.Options, returns the options of the link

where oLink is an object of Link type

GetTo() → {number|string|ItemBar}

The GetTo() method indicates the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link ends to (out-item-bar).
Returns:
Returns the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link ends to (out-item-bar), as one of the following:
  • to {number}, indicates a numeric value that defines the index of the item (single/first item-bar of the item)
  • to {string}, specifies a string expression that defines the identifier/key of the item (single/first item-bar of the item)
  • to {ItemBar}, specifies the object reference to the item-bar
Type
number | string | ItemBar

GetType() → {number}

The GetType() method gets the link's type. Tasks may have multiple predecessors or multiple successors.

Before you begin establishing dependencies, it’s important to understand that there are four types:

  • Finish to Start (FS), the predecessor ends before the successor can begin
  • Start to Start (SS), the predecessor begins before the successor can begin
  • Finish to Finish (FF), the predecessor ends before the successor can end
  • Start to Finish (SF), the predecessor begins before the successor can end
Since:
  • 2.3
Returns:
Returns link's type, as one of the following value: 1 {number} indicates a SF link (SF, S(tart)-F(inish)) 2 {number} indicates a FS link (FS, F(inish)-S(tart)) 4 {number} indicates a FF link (FF, F(inish)-F(inish)) 8 {number} indicates a SS link (SS, S(tart)-S(tart)) The value 1(SF) is never returned.
Type
number

GetVisible() → {boolean}

The GetVisible() method returns whether the link is visible or hidden
Returns:
Returns true if the link is visible, or false if the link is not visible
Type
boolean

GetWorkingLag() → {number}

The GetWorkingLag() method returns the link's working-lag (specifies the delay (in working days) between linked-activities during the Items.SchedulePDM() method)
Returns:
Returns link's working-lag
Type
number

Remove()

The Remove() method removes the link itself from its collection

SetCaption(value)

The SetCaption() method changes the link's caption
Parameters:
Name Type Description
value string Specifies a new ex-HTML caption to be assigned to the link
Example
null {null}, indicates no caption
 "caption" {string}, declares a plain-caption
 "&lt;b>text&lt;/b>" {string}, displays the text in bold
 "&lt;img>logo&lt;/img>" {string}, displays the "logo" image. The image can be added using the exontrol.HTMLPicture.Add() method

SetFrom(value)

The SetFrom() method defines the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link starts from (in-item-bar).
Parameters:
Name Type Description
value number | string | ItemBar Specifies the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link starts from (in-item-bar), as one of the following:
  • from {number}, indicates a numeric value that defines the index of the item (single/first item-bar of the item)
  • from {string}, specifies a string expression that defines the identifier/key of the item (single/first item-bar of the item)
  • from {ItemBar}, specifies the object reference to the item-bar

SetKey(value)

The SetKey() method assigns a new key to the link
Parameters:
Name Type Description
value string Specifies a new key to be assigned to the link
Example
"logo" {string}, defines the link with the giving key (logo). You can use the oGantt.Chart.Links.Item("logo") method to request the link giving its key.

SetLag(value)

The SetLag() method sets the link's lag (specifies the delay (in days) between linked-activities during the Items.SchedulePDM() method)
Parameters:
Name Type Description
value number Specifies a new link's lag
Example
null {null}, no lag between linked-activities
 2 {number}, indicates 2 days between linked-activities
The SetLink() method changes the appearance of the link between item-bars.
Parameters:
Name Type Description
value DisplayLinkType Specifies the appearance of the link between item-bars, as an object of {type, dir, width, color, arrow, style, startPos, endPos} type, where:
  • type {exontrol.LinkTypeEnum}, specifies the type of the link as 0 (rectangular), 1 (direct), 2(straight) or 3(round)
  • dir {number}, specifies whether the link's direction is shown or hidden as 0 (hidden), 1(shows the direction/arrow where the link begins), 2(shows the direction where the link ends, default) or 3 shows the arrows in both sides
  • width {number}, specifies the link's width or size (1 by default)
  • color {string}, indicates the link's color (partial-black by default)
  • arrow {string}, indicates the arrow's color. If it is missing or not specified the arrow is shown using the link's color (gray by default)
  • arrowSize {number}, indicates the arrow's size. If it is missing or not specified the arrow's size is defined by link's width (1 by default) (since 2.2)
  • arrowShape {object}, defines an object of exontrol.Def.Shape type to customize the shape of the link's arrow (for instance shows the link's arrow as a circle instead of a triangle) (since 2.2)
  • style {array}, specifies the link's dash pattern to show the lines (solid by default)
  • startPos {any}, indicates the list of corners of in-element, the link can start from
  • endPos {any}, indicates the list of corners of out-element, the link can end to

SetOptions(oOpts)

The SetOptions() method changes the link's options (visibility, caption, ...) at once
Parameters:
Name Type Description
oOpts object Specifies an object of LinkOptions type that holds information about the link, such as caption, image and so on. If the oOpts parameter is not-of object type it indicates the link's caption instead

SetTo(value)

The SetTo() method defines the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link ends to (out-item-bar).
Parameters:
Name Type Description
value number | string | ItemBar Specifies the index, identifier/key of the item that hosts the bar, or reference of the item-bar the link ends to (out-item-bar), as one of the following:
  • to {number}, indicates a numeric value that defines the index of the item (single/first item-bar of the item)
  • to {string}, specifies a string expression that defines the identifier/key of the item (single/first item-bar of the item)
  • to {ItemBar}, specifies the object reference to the item-bar

SetType(value)

The SetType() method sets the link's type. Tasks may have multiple predecessors or multiple successors.

Before you begin establishing dependencies, it’s important to understand that there are four types:

  • Finish to Start (FS), the predecessor ends before the successor can begin
  • Start to Start (SS), the predecessor begins before the successor can begin
  • Finish to Finish (FF), the predecessor ends before the successor can end
  • Start to Finish (SF), the predecessor begins before the successor can end
Parameters:
Name Type Description
value any Specifies the new link's type, as one of the following value:
  • 1 {number} indicates a SF link (SF, S(tart)-F(inish)) (the startPos is set on left, endPos is set on right, the Type returns 1)
  • 2 {number} indicates a FS link (FS, F(inish)-S(tart)) (the startPos is set on right, endPos is set on left, the Type returns 2)
  • 4 {number} indicates a FF link (FF, F(inish)-F(inish)) (the startPos is set on right, endPos is set on right, the Type returns 4)
  • 8 {number} indicates a SS link (SS, S(tart)-S(tart)) (the startPos is set on left, endPos is set on left, the Type returns 8)
or
  • "SF" {string} indicates a SF link (SF, S(tart)-F(inish)) (the startPos is set on left, endPos is set on right, the Type returns 1)
  • "FS" {string} indicates a FS link (FS, F(inish)-S(tart)) (the startPos is set on right, endPos is set on left, the Type returns 2)
  • "FF" {string} indicates a FF link (FF, F(inish)-F(inish)) (the startPos is set on right, endPos is set on right, the Type returns 4)
  • "SS" {string} indicates a SS link (SS, S(tart)-S(tart)) (the startPos is set on left, endPos is set on left, the Type returns 8)
Since:
  • 2.3
Example
2 or any other value except 1, 4 or 8 {number}, indicates a FS link (FS, F(inish)-S(tart))
 4 {number}, indicates a FF link (FF, F(inish)-F(inish))
 "SS" {string}, indicates a SS link (SS, S(tart)-S(tart))

SetVisible(value)

The SetVisible() method shows or hides the link
Parameters:
Name Type Description
value boolean Indicates a boolean expression that specifies whether the link is visible or hidden
Example
false {boolean}, hides the link
 true {boolean}, shows the link

SetWorkingLag(value)

The SetWorkingLag() method sets the link's working-lag (specifies the delay (in working days) between linked-activities during the Items.SchedulePDM() method)
Parameters:
Name Type Description
value number Specifies a new link's working-lag
Example
null {null}, no lag between linked-activities
 2 {number}, indicates 2 working-days between linked-activities