Item class (Gantt)

Item(oItems, oItems)

new Item(oItems, oItems)

The Item object holds the cells and options of the item within the control. The Tree.Item(id) method returns the item based on its index or identifier/key. The Item.Cell(id) method gets the item's cell giving the column's index, identifier/key/caption or reference.

Every option of the ItemOptions type has associated a property of the Item object. For instance, the option:

cursor {string}, defines the mouse-cursor for individual item
is associated with the property:
Cursor {string}, defines the mouse-cursor for individual item
which means that the following statements are equivalent:
oItem.Options = {cursor: "pointer"}
oItem.SetOptions({cursor: "pointer"})
oItem.Cursor = "pointer"
oItem.SetCursor("pointer")
where oItem is an object of Item type

The Item type defines additional properties and methods of the Item(extree) type.

Parameters:
Name Type Description
oItems Items Indicates an object of Items type that's the owner collection of this item.
oItems ItemOptions Specifies the options to apply on the item.

Members

AllowSizing :boolean

The AllowSizing property makes an item resizable or fixed, as explained:
  • null {null}, the control's itemAllowSizing field specifies whether the item is resizable or fixed
  • false {boolean}, the item is fixed
  • true {boolean}, the item is resizable, so user can resize the item by drag (if "item-resize" action is allowed)

The onchange("resize-item") event is raised only when the item height is changed by dragging. The "item-resize" action allows the user to change the height of an item by dragging it. The AllowSizing property is equivalent with GetAllowSizing()/SetAllowSizing(value) methods.

Type:
  • boolean
Example
null {null}, the control's itemAllowSizing field specifies whether the item is resizable or fixed
false {boolean}, the item is fixed
true {boolean}, the item is resizable, so user can resize the item by drag (if "item-resize" action is allowed)
AllowSizing

Bars :ItemBars

The Bars property sets the bars of the current item. The Bars property defines the bars of the current item, as an object of exontrol.Gantt.ItemBars type. The bars proprty can be get/set via the GetBars()/SetBars() methods. The following methods are equivalent:
Type:
Since:
  • 1.7
Example
The following samples are equivalent:

 oItem.SetBars(null)
 oItem.Bars = null
 oItem.ClearBars()
 oItem.Bars.Clear()

The following samples set the bars of oItem:

 oItem.Bars = null, clears any previously bars of oItem
 oItem.Bars = oGantt.Item(0).Bars {ItemBars}, copies the bars of the first item of the chart to oItem

where oGantt is an object of Gantt type and oItem is an object of Item type
Bars

(readonly) ChildCount :number

The ChildCount property returns the number of child items of the item. The ChildCount property is equivalent with the GetChildCount() method. The ChildCount property returns the number of child items or 0 if the item has no children. The Item.Add metod adds a child item to the item, while the Item.Remove method removes a child item from the item. The Child() method gets the child item at the specified index within the item's children collection.
Type:
  • number
Since:
  • 5.1
Example
The following code snippet:

   for ( var i = 0; i < oItem.ChildCount; i++ )
     console.log( oItem.Child(i) );

 enumerates all child-items of oItem
ChildCount

Cursor :string

The Cursor property gets or sets the mouse cursor for the item itself. The Cursors/GetCursors()/SetCursors(value) {string}, defines the mouse cursor to display when pointing over different parts of the control. The GetCursor() method returns the mouse-cursor for the item itself. The SetCursor() method changes the mouse cursor for the item itself.
Type:
  • string
Example
"pointer" {string}, The cursor is a pointer that indicates a link (typically an image of a pointing hand)
Cursor

Divider :any

The Divider property gets or sets the index or identifier/key/caption or reference of the cell that's single displayed by the item. A divider-item displays a single cell only, while a multiple-columns item displays all cells. The GetDivider() method gets the index or identifier/key/caption or reference of the cell that's single displayed by the item. The SetDivider() method sets the index or identifier/key/caption or reference of the cell that's single displayed by the item.
Type:
  • any
Example
null {null}, multiple-columns item (no divider-item)
0 {number}, divider-item that always displays the cell with the index 0
"xxx" {string}, divider-item that always displays the cell on the column "xxx" (key or plain-caption)
Divider

Enabled :boolean

The Enabled property enables or disables the item. A disabled item cannot be selected or edited. A disabled item is displayed in gray, depending on the current theme of the control. The Shapes property may define a different appearance for disabled items. The Selectable property specifies whether the item is selectable. The Enabled property is equivalent with GetEnabled()/SetEnabled(value) methods.
Type:
  • boolean
Example
false {boolean}, disables the item
true {boolean}, enables the item
Enabled

Expanded :boolean

The Expanded property expands or collapses the item. The GetExpanded() method specifies whether the item is expanded or collapsed. The SetExpanded() method expands or collapses the item. The onchange("expand-item") event is raised when the item is expanded or collapsed (only by user interaction, not by API calls). The ExpandAll() method expands or collapses all items based on the giving parameter (true to expand, false to collapse). The ToggleExpand() method toggles the item's expand state. For instance, if the item is expanded, the ToggleExpand() method collapses the item. The Expanded property is equivalent with GetExpanded()/SetExpanded(value) methods.
Type:
  • boolean
Example
false {boolean}, the item is collapsed
true {boolean}, the item is expanded (item's children are shown)
Expanded

(readonly) GroupItem :number

The GroupItem property indicates a group item if positive or zero (specifies the index of the column that has been grouped). It is equivalent with the GetGroupItem() method. The GroupItem property is an integer value that specifies the index of the column that has been grouped. A regular item returns -1 by GroupItem property. The onaddgroupitem and onremoveitem events are raised when an item is added or removed as a group-item, respectively.
Type:
  • number
Example
The following statements are equivalents:

 oItem.GetGroupItem(), indicates a group item if positive or zero
 oItem.GroupItem, indicates a group item if positive or zero

where oItem is an object of Item type
GroupItem

Height :array

The Height property defines the item's individual height. The GetHeight() method returns the item's individual height (if defined). The SetHeight() method changes the item's individual height. The control's defaultItemHeight field defines the default height for all items that have no individual height defined. The onchange("resize-item") event is raised only when the item height is changed by dragging. The AllowSizing property allows the user to change the height of items by dragging. The "item-resize" action allows the user to change the height of an item by dragging it. The Height property is equivalent with GetHeight()/SetHeight(value) methods.
Type:
  • array
Example
null {null}, indicates that the item's height is defined by the control's defaultItemHeight field (22)
18 {number}, specifies the item's height to 18
Height

(readonly) Index :number

The Index property retrieves the item's index (0-based). The Index property is read-only. The Index property is equivalent with GetIndex() method. The Position property is equivalent with GetPosition()/SetPosition(value) methods. The Position property gets or sets the item's position (0-based).
Type:
  • number
Example
The following statements are equivalents:

 oItem.GetIndex(), retrieves the item's index
 oItem.Index, retrieves the item's index

where oItem is an object of Item type
Index

Key :string

The Key property assigns a new key to the item. The Key property is equivalent with GetKey()/SetKey(value) methods. The Key property specifies the item's key (the Items.Item(key) requests an item by its index, identifier/key or reference). The key is used to identify the item and to request it by its key using the Items.Item(key) method. If the item's key is missing or empty its index is used instead.
Type:
  • string
Example
"logo" {string}, defines the item with the giving key (logo). You can use the Root.Item("logo") method to request the item giving its key.
Key

Lock :Gantt.LockItemEnum

The Lock property locks or unlocks the item, placing it at the top, bottom, or making it scrollable, as explained:
  • exontrol.Gantt.LockItemEnum.exLockTop {Gantt.LockItemEnum} or -1 {number}, locks the item at the top
  • exontrol.Gantt.LockItemEnum.exUnlock {Gantt.LockItemEnum} or 0 {number}, unlocks the item, making it scrollable
  • exontrol.Gantt.LockItemEnum.exLockBottom {Gantt.LockItemEnum} or +1 {number}, locks the item at the bottom
The GetLockedItemsCount(alignment)/SetLockedItemsCount(alignment, value), specifies the number of items fixed on the top or bottom side of the control. The Lock property is equivalent with GetLock()/SetLock(value) methods.
Type:
Since:
  • 4.6
Example
"top" {string} or -1 {number}, locks the item at the top
"unlock" {string} or 0 {number}, unlocks the item, making it scrollable
Lock

(readonly) Locked :number

The Locked property determines whether the items is locked and in which section of the control it is placed - either locked at the top, scrollable, or locked at the bottom, as explained below:
  • -1 {number}, indicates that item is part of locked-items (top)
  • 0/null/undefined {number}, indicates that item is part of scrollable items (unlocked)
  • +1 {number}, indicates that item is part of locked-items (bottom)

The Lock property locks or unlocks the item, placing it at the top, bottom, or making it scrollable. The onclick event may not be fired if the Locked property is true

Type:
  • number
Since:
  • 4.6
Example
The following statements are equivalents:

   if (oItem.Locked) { ... }  // checks whether the item is locked (either at top or bottom of the control)

 where oItem is an object of Item type
Locked

NonworkingUnits :string

The NonworkingUnits property gets or sets a formula that determines the use of custom non-working units for the item. The NonworkingDays and NonworkingHours properties define the non-working periods for the chart, applied to items where nonworkingUnits is undefined.

The expression supports:

  • "value" keyword (the value keyword indicates the date-time unit to check, as a Date type)
  • string and date-time operators (len, mid, year, month, day, weekday, hour, minute, second, date, time, now, ...)
  • comparison operators (=, <>, <, <=, >, >=)
  • arithmetic operators (+, -, *, /, mod, ...)
  • logical operators (and, or, ...)
  • bitwise operators (bitor, bitand, ...)
  • predefined constants (dpi, bias, ...)
Type:
  • string
Since:
  • 4.3
Example
"0" {string}, all only working units, no not-working units
"month(value) = 1" {string}, all January is non-working
"weekday(value) = 0" {string}, all Sundays are non-working only
NonworkingUnits

Options :ItemOptions

The Options property defines the item's options (visibility, caption, ...) at once. You can get or set the item's options using the Options property. The Options property is equivalent with GetOptions()/SetOptions(value) methods. Each option of the ItemOptions type has associated a property of the Item object. For instance, the option:
cursor {string}, defines the mouse-cursor for individual item
is associated with the property:
Cursor {string}, defines the mouse-cursor for individual item
which means that the following statements are equivalent:
oItem.Options = {cursor: "pointer"}
oItem.SetOptions({cursor: "pointer"})
oItem.Cursor = "pointer"
oItem.SetCursor("pointer")
where oItem is an object of Item type.
Type:
Example
The following statements are equivalents:

 oGantt.Item(0).Options = {shape: "red", height: 32}, changes the item's height and background
 oGantt.Item(0).SetOptions({shape: "red", height: 32}), changes the item's height and background

where oGantt is an object of Gantt type
Options

Parent :null|Item

The Parent property gets or sets the item's parent as explained below.
  • {number}, indicates a numeric value that defines the index of the parent's item
  • {string}, specifies a string expression that defines the identifier/key of the parent's item
  • {Item}, specifies the object reference to the parent's item

The Parent property is equivalent with the GetParent() and SetParent() methods. The GetParent() method returns the item's parent as an object of Item type. The SetParent() method sets the item's parent. The Position property gets or sets the item's position (0-based). The onchange("drag-item") event occurs once the user moves the item by drag an drop. The user can move an item to a new position within the control by drag and drop when the "item-drag" action is enabled in the AllowActions property.

Type:
Example
0 {number}, indicates that the item with the index 0 is the parent of the current item
"key" {string}, specifies that the parent of the current item is the item with the giving key
Parent

Position :number

The Position property gets or sets the item's position. The Position property is equivalent with GetPosition()/SetPosition(value) methods. The Index property is equivalent with GetIndex() method. The Index property retrieves the item's index (0-based). The position for each item can change once the user sorts a column or repositions them using drag-and-drop operation. The onchange("drag-item") event occurs once the user moves the item by drag an drop. The user can move an item to a new position within the control by drag and drop when the "item-drag" action is enabled in the AllowActions property.
Type:
  • number
Example
The following statements are equivalents:

 oItem.GetPosition(), retrieves the item's position
 oItem.Position, retrieves the item's position

where oItem is an object of Item type
Position

Selectable :boolean

The Selectable property defines whether the item is selectable. An unselectable item cannot be selected by user interaction. The Selectable property is equivalent with GetSelectable()/SetSelectable(value) methods. The GetSelectable() method specifies whether the item is selectable. The SetSelectable() method defines whether the item is selectable.
Type:
  • boolean
Example
false {boolean}, the item is unselectable
true {boolean}, the item is selectable
Selectable

Selected :boolean

The Selected property defines whether the item is selected. The Selection property of the control holds the collection of selected items. The Selectable/GetSelectable()/SetSelectable(value) {boolean}, specifies whether the item is selectable. The Selected property is equivalent with GetSelected() and SetSelected() methods. The onselchange event is raised when the selection is changed. The SingleSel property gets or sets the control's selection to single, multiple or toggle.
Type:
  • boolean
Example
false {boolean}, the item is unselected
true {boolean}, the item is selected
Selected

Shape :any

The Shape property defines the shape for the item itself as one of the following:
  • null, no custom-shape is applied on the object (default-shape may be applied instead)
  • the shape's name within the exontrol.Shapes.Gantt or exontrol.Shapes namespace
  • a CSS color
  • a JSON string-representation of an object of exontrol.Def.Shape type
  • an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type

The Cell.Shape property changes the shape for the cell itself. The Column.CellShape property gets or sets the shape to apply on the column's body/data/cells. The Column.Shape property defines the shape to apply on the column's header. The Shapes property defines the shapes for each part of the control can display.

Type:
  • any
Example
null {null}, no custom shape is applied (default object's shape may be applied)
"" {string}, no custom shape is applied (no default object's shape is be applied)
"red" {string}, fills the object's background in red (CSS color)
'{"fillColor": "red"}' or '{"normal":{"fillColor": "red"}}' {string}, fills the object's background in red (JSON-representation of an object of exontrol.Def.Shape type)
"xxx" {string}, indicates that exontrol.Shapes.Gantt.xxx or exontrol.Shapes.xxx is applied on the object's background. If the xxx field is missing, no custom shape is applied (no default object's shape is be applied)
"Button" or exontrol.Shapes.Button {object}, applies the "Button" shape on the object as defined into exontrol.Shapes namespace (@since 5.2)
Shape

ShowExpand :boolean|number

The ShowExpand property specifies whether the item's expand/collapse glyphs is visible or hidden. The ShowExpand property is equivalent with GetShowExpand() and SetShowExpand() methods. The ShowExpand property can be one of the following values:
  • false {boolean}, the item hides its expand/collapse glyphs (no indentation is applied)
  • true {boolean}, the item shows its expand/collapse glyphs (indentation is applied)
  • -1 {number}, the item shows no expand/collapse glyphs, instead indentation is applied
By default, the ShowExpand property is null, which indicates that the expand/collapse glyphs are shown for items that have children, otherwise the expand/collapse glyphs are hidden.
Type:
  • boolean | number
Example
false {boolean}, the item hides its expand/collapse glyphs (no indentation is applied)
true {boolean}, the item shows its expand/collapse glyphs (indentation is applied)
-1 {number}, the item shows no expand/collapse glyphs, instead indentation is applied
ShowExpand

Sortable :boolean

The Sortable property defines whether the item is sortable. A sortable item can change its position after sorting, while an unsortable item keeps its position after sorting. The Position property specifies the item's position within the collection of items.
Type:
  • boolean
Example
false {boolean}, the item is unsortable (an unsortable item keeps its position after user performs a sort operation)
true {boolean}, the item is sortable
Sortable

Value :null|any|Array.<any>

The Value property gets or the value for each cell of the item. The SetValue() method changes the value for each cell of the item. The GetValue() method returns the values for each cell of the item, as an array of [any] type. The Value property is equivalent with GetValue() and SetValue() methods. The onanchorclick event is fired when the user clicks an anchor element (the <a id;options> ex-HTML part marks an anchor or hyperlink element), and provides information about the anchor being clicked, such as the anchor's identifier and options. The onchange("change-cell") event occurs when the cell's value has been changed through the UI. Editing the cell's content in the UI requires the "edit" action to be enabled in the AllowActions property.
Type:
  • null | any | Array.<any>
Since:
  • 1.1
Example
null {null}, resets the caption for all cells of the item
"caption" {string}, defines the plain-caption for all cells of the item
["&lt;img&gt;al&lt;/img&gt;Alexa","&lt;img&gt;dtop&lt;/img&gt;Darius"] {string[]}, specifies the captions for the first two-cells (includes images too, The image can be added using the exontrol.HTMLPicture.Add method)
Value

Visible :boolean

The Visible property shows or hides the item. The Visible property is equivalent with GetVisible()/SetVisible(value) methods. The Height property gets or sets the item's height. By default, the item is visible. A hidden item is not displayed within the control, and it does not take part in layout and interaction (selection, hover, etc.). The child-items of a hidden item are also hidden regardless of their own Visible property value. The Visible property is used when you need to hide an item temporarily, without removing it from the control. If you need to remove an item from the control, use the Remove() method instead.
Type:
  • boolean
Example
false {boolean}, hides the item
true {boolean}, shows the item
Visible

Methods

Add(oOptionsopt) → {Item}

The Add() method creates and adds a new child-item into the control. The Add() method accepts an object of ItemOptions type as parameter, to define the new item. The Add() method returns the newly created item as an object of Item type. The onadditem event is raised when a new item is added into the control. The Items.Add() method creates and adds a new root-item into the control.
Parameters:
Name Type Attributes Description
oOptions object <optional>
Specifies the options to create the new item as an object of ItemOptions type.
Returns:
Returns the newly created item, as an object of Item type
Type
Item
Example
oGantt.Item(0).Add("caption"), adds a new child-item of the first item, and sets the caption for the first cell.
oGantt.Item(0).Add({value: "caption"}), adds a new child-item of the first item, and sets the caption for the first cell.
oGantt.Item(0).Add(["Cell 1","Cell 2"]), adds a new child-item of the first item, and sets the caption for the first and second cell.
oGantt.Item(0).Add({value: ["Cell 1","Cell 2"]}), adds a new child-item of the first item, and sets the caption for the first and second cell.
Add

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

The AddBar() method adds a bar for the current item, and returns an object of ItemBar type. The method accepts either the parameters (name, start, end, key, text) or a single parameter as an object of ItemBarOptions type that specifies the options of the bar to create. The name parameter defines the name/type of the bar to create, and it is used to apply a predefined visual appearance to the bar. The start and end parameters specify the date-time the bar starts from and ends to. The key parameter is used to identify the bar in case the item hosts multiple bars, while it is optional if the item hosts a single bar. The text parameter specifies the bar's exHTML caption, and it is optional as well. No item-bar is created if the item already hosts an item-bar with the same key. The RemoveBar() method removes a bar of the current item giving its key. The ClearBars() method clears all bars of the item. The onadditem event occurs when an item is added into the control, and it is useful to add a bar for the item being added. The ItemBar method gets the bar of the current item giving its key, and returns an object of ItemBar type, while the Bars property gets the bars of the current item, as an object of exontrol.Gantt.ItemBars type. The AddBar method is equivalent with Add method of ItemBars type, but it is more intuitive and easier to use when adding a single bar for an item, while the ItemBars.Add method is more useful when adding multiple bars for an item.
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 + "#");
});

or

oGantt.on("additem", function(oItem)
{
   oItem.AddBar("Task", "#" + oItem.Cell("Start").Value + "#", "#" + oItem.Cell("End").Value + "#");
});
AddBar

Cell(column) → {Cell}

The Cell() method gets the item's cell giving the column's index, identifier/key/caption or reference. The Cell() method is equivalent with the Gantt.Cell(item,column) method of control. The Cell.Value property gets or the value for each cell of the item. The Cell.Caption property gets the caption for each cell of the item. The Cell.Shape property gets or sets the shape for each cell of the item. The Cell.Cursor property gets or sets the mouse cursor for each cell of the item. The Cell() method returns null if the column is not found, or an object of Cell type that specifies the requested cell.
Parameters:
Name Type Description
column any The id parameter could be any of the following:
  • column {number}, indicates a numeric value that defines the index of the column to request
  • column {string}, specifies a string expression that defines the identifier/key/caption/plain-caption of the column to request
  • column {Column}, specifies the object reference to the column to request for
Returns:
Returns null if the column is not found, or an object of Cell type that specifies the requested cell
Type
Cell

Child(index) → {Item}

The Child() method gets the child item at the specified index within the item's children collection. The Item.Add metod adds a child item to the item, while the Item.Remove method removes a child item from the item. The Child and ChildCount members allow you to enumerate the child items of the item. The Child() method supports negative indexes as well, where -1 indicates the last added child item, -2 the second last, and so on. If the specified index is out of bounds, the Child() method returns null.
Parameters:
Name Type Description
index number Specifies the zero-based index of the child item to retrieve (supports negative indexes as well, where -1 indicates the last added child item, -2 the second last, and so on).
Since:
  • 5.1
Returns:
Returns the child item at the specified index, or null if the index is out of bounds.
Type
Item
Example
The following code snippet:

   for ( var i = 0; i &lt; oItem.GetChildCount(); i++ )
     console.log( oItem.Child(i) );

 enumerates all child-items of oItem
Child

ClearBars()

The ClearBars() method clears all bars of the item. The Bars.Clear method clears all type of bars of the control, but do not remove the bars collection of the item, while this method clears all bars of the item and removes the bars collection of the item as well. The RemoveBar method removes a bar of the item giving its key. The ClearBars() method is useful when the item hosts a single bar, while the RemoveBar() method is useful when the item hosts multiple bars and you need to remove a specific bar giving its key. The ItemBar method gets the bar of the current item giving its key, and returns an object of ItemBar type, while the GetBars() method gets the bars of the current item, as an object of exontrol.Gantt.ItemBars type. The ClearBars() method is equivalent with Clear method of ItemBars type, but it is more intuitive and easier to use when clearing a single bar of an item, while the ItemBars.Clear method is more useful when clearing multiple bars of an item. The onremoveitem event occurs when an item is removed from the control, and it is useful to remove the bars of the item being removed. The ItemBar method gets the bar of the current item giving its key, and returns an object of ItemBar type, while the Bars property gets the bars of the current item, as an object of exontrol.Gantt.ItemBars type. The ClearBars() method does nothing if the item has no bar.
Example
oItem.ClearBars(), clears all bars of oItem and removes the bars collection of the item
ClearBars

ItemBar(key) → {ItemBar}

The ItemBar() method gets the bar of the current item giving its key, and returns an object of ItemBar type. The RemoveBar() method removes a bar of the current item giving its key. The ClearBars() method clears all bars of the item. The ItemBar method gets the bar of the current item giving its key, and returns an object of ItemBar type, while the GetBars() method gets the bars of the current item, as an object of exontrol.Gantt.ItemBars type. The ItemBar() method is useful when the item hosts multiple bars and you need to get a specific bar giving its key, while the Bars property is useful when the item hosts a single bar. The ItemBar() method returns undefined if there is no bar with the given key. The onremoveitem event occurs when an item is removed from the control, and it is useful to remove the bars of the item being removed. The ItemBar method gets the bar of the current item giving its key, and returns an object of ItemBar type, while the Bars property gets the bars of the current item, as an object of exontrol.Gantt.ItemBars type. The ItemBar() method is equivalent with ItemBars.Item() method, but it is more intuitive and easier to use when getting a single bar of an item, while the ItemBars.Item() method is more useful when getting multiple bars of an item.
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

Remove()

The Remove() method removes the item itself from the items collection. The Remove() method is equivalent with Items.Remove(oItem) method, where oItem is the item to remove. The Remove() method accepts the same parameters as the Item() method to locate the item to remove. The RemoveSelection method removes all selected items at once. The onremoveitem event is raised for each item being removed, and the onremoveitem event is raised once after all items are removed.

RemoveBar(key) → {object}

The RemoveBar() method removes a bar of the current item giving its key. The ClearBars() method clears all bars of the item. The Bars.Clear method clears all type of bars of the control, but do not remove the bars collection of the item, while this method clears all bars of the item and removes the bars collection of the item as well. The RemoveBar method removes a bar of the item giving its key. The ItemBar method gets the bar of the current item giving its key, and returns an object of ItemBar type, while the GetBars() method gets the bars of the current item, as an object of exontrol.Gantt.ItemBars type. The RemoveBar() method is useful when the item hosts multiple bars and you need to remove a specific bar giving its key, while the ClearBars() method is useful when the item hosts a single bar. The RemoveBar() method does nothing if there is no bar with the given key. The onremoveitem event occurs when an item is removed from the control, and it is useful to remove the bars of the item being removed. The ItemBar method gets the bar of the current item giving its key, and returns an object of ItemBar type, while the Bars property gets the bars of the current item, as an object of exontrol.Gantt.ItemBars type. The RemoveBar is equivalent with Remove method of ItemBars type, but it is more intuitive and easier to use when removing a single bar of an item, while the ItemBars.Remove method is more useful when removing multiple bars of an item.
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
Example
oItem.RemoveBar("T"), removes the "T" bar of oItem, if any
RemoveBar

ToggleExpand()

The ToggleExpand() method toggles the item's expand state. For instance, if the item is expanded, the ToggleExpand() method collapses the item. The Expanded property expands or collapses the item. The onchange("expand-item") event is raised when the item is expanded or collapsed (only by user interaction, not by API calls). The ExpandAll() method expands or collapses all items based on the giving parameter (true to expand, false to collapse).
Example
oGantt.Item(0).ToggleExpand(), toggles the expand state of the first item. If the first item is expanded, it will be collapsed, and if it is collapsed, it will be expanded.
ToggleExpand