Class: Item

Item()

new Item()

The Item type defines additional properties and methods of the Item(extree) type. The Item(id) method returns the item based on its index or identifier.

Methods

(static) AddBar(name, start, end, keyopt, textopt) → {ItemBar}

The AddBar() method adds a bar for the current item, and returns an object of ItemBar type
Parameters:
Name Type Attributes Description
name string Indicates the name/type of the bar to create or an object of ItemBarOptions type that specifies the options of the bar to create (single parameter)
start Date Specifies the date-time the bar starts from
end Date Specifies the date-time the bar ends to
key any <optional>
Indicates the key of the bar to create
text string <optional>
Specifies the bar's exHTML caption
Returns:
Returns the newly created item-bar, as an object of ItemBar type (no item-bar is created if the item already hosts an item-bar with the same key)
Type
ItemBar
Example
The following sample adds a new "Task" bar for each item being added:

oGantt.Listeners.Add("onadditem", function(oItem)
{
   oItem.AddBar("Task", "#" + oItem.Cell("Start").Value + "#", "#" + oItem.Cell("End").Value + "#");
});

(static) ClearBars()

The ClearBars() method clears all bars of the item

(static) GetBars() → {ItemBars}

The GetBars() method gets the bars of the current item
Since:
  • 1.7
Returns:
Returns null or undefined (no bar) or an object of {ItemBars} type that holds the bars of the item
Type
ItemBars

(static) ItemBar(key) → {ItemBar}

The ItemBar() method gets the bar of the current item giving its key, and returns an object of ItemBar type
Parameters:
Name Type Description
key any Specifies the key of the bar to request
Returns:
Returns undefined (no bar found) or an object of ItemBar type that holds the bar being created
Type
ItemBar

(static) RemoveBar(key) → {object}

The RemoveBar() method removes a bar of the current item giving its key
Parameters:
Name Type Description
key any Specifies the key of the bar to delete
Returns:
Returns undefined (no bar found) or an object of ItemBar type that holds the bar being created
Type
object

(static) SetBars() → {ItemBars}

The GetBars() method gets the bars of the current item
Since:
  • 1.7
Returns:
Returns null or undefined (no bar) or an object of ItemBars type that holds the bars of the item
Type
ItemBars