Class: Item

Item(oItems, oItems)

new Item(oItems, oItems)

The Item object holds the cells and options of the item within the control. The Item(id) method returns the item based on its index or identifier/key. The 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
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

Methods

Add(oOptionsopt) → {Item}

The Add() method creates and adds a new child-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
oTree.Item(0).Add("caption"), adds a new child-item of the first item, and sets the caption for the first cell.
 oTree.Item(0).Add({value: "caption"}), adds a new child-item of the first item, and sets the caption for the first cell.
 oTree.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.
 oTree.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.

Cell(column) → {Cell}

The Cell() method gets the item's cell giving the column's index, identifier/key/caption or reference. The Cell(item,column) method of Tree control is equivalent with this method.
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

GetAllowSizing() → {boolean}

The GetAllowSizing() method specifies whether the item is resizable or fixed
Returns:
Returns one of the following values:
  • 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)
Type
boolean

GetCursor() → {string}

The GetCursor() method defines the mouse cursor for the item itself.
Returns:
Returns the mouse-cursor for the item itself.
Type
string

GetDivider() → {any}

The GetDivider() method gets the index or identifier/key/caption or reference of the cell that's single displayed by the item
Returns:
Returns the index or identifier/key/caption or reference of the cell that's single displayed by the item
Type
any

GetEnabled() → {boolean}

The GetEnabled() method determines whether the item is enabled or disabled
Returns:
Returns true if the item is enabled, or false if the item is disabled
Type
boolean

GetExpanded() → {boolean}

The GetExpanded() method specifies whether the item is expanded or collapsed.
Returns:
Returns true if the item is expanded.
Type
boolean

GetGroupItem() → {number}

The GetGroupItem() method indicates a group item if positive or zero (specifies the index of the column that has been grouped)
Returns:
Returns -1(no group item) or zero or a positive value that indicates the index of the column that has been grouped
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

GetHeight() → {array}

The GetHeight() method returns the item's individual height
Returns:
Returns item's individual height
Type
array

GetIndex() → {any}

The GetIndex() method retrieves the item's index.
Returns:
Returns the item's index (0-based)
Type
any
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

GetKey() → {string}

The GetKey() method returns the item's key.
Returns:
Returns the item's exHTML key it displays
Type
string

GetOptions() → {object}

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

 oItem.GetOptions(), returns the item's options
 oItem.Options, returns the item's options

where oItem is an object of Item type

GetParent() → {null|Item}

The GetParent() method gets the item's parent.
Returns:
Returns the item's parent as an object of Item type
Type
null | Item

GetPosition() → {any}

The GetPosition() method retrieves the item's position.
Returns:
Returns the item's position
Type
any
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

GetSelectable() → {boolean}

The GetSelectable() method specifies whether the item is selectable
Returns:
Returns true if the item is selectable.
Type
boolean

GetSelected() → {boolean}

The GetSelected() method specifies whether the item is selected
Returns:
Returns true if the item is selected.
Type
boolean

GetShape() → {any}

The GetShape() method defines the shape for the item itself.
Returns:
Returns 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.Shape.Tree or exontrol.Shape namespace
  • a CSS color
  • a JSON string-representation of an object of exontrol.Def.Shape type, for the column itself
  • an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type
Type
any

GetShowExpand() → {boolean}

The GetShowExpand() method specifies whether the item's expand/collapse glyphs is visible or hidden
Returns:
Returns true if the item's expand/collapse glyphs is visible
Type
boolean

GetSortable() → {boolean}

The GetSortable() method specifies whether the item is sortable
Returns:
Returns true if the item is sortable.
Type
boolean

GetValue() → {Array.<any>}

The GetValue() method returns the values for each cell of the item, as an array of [any] type
Since:
  • 1.1
Returns:
Returns the values for each cell of the item, as an array of [any] type
Type
Array.<any>

GetVisible() → {boolean}

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

Remove()

The Remove() method removes the item itself from the items collection

SetAllowSizing(value)

The SetAllowSizing() method makes an item resizable or fixed
Parameters:
Name Type Description
value boolean Specifies whether the item is 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)
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)

SetCursor(value)

The SetCursor() method changes the mouse cursor for the item itself.
Parameters:
Name Type Description
value any A string expression that defines the mouse cursor for the item itself.
Example
"pointer" {string}, The cursor is a pointer that indicates a link (typically an image of a pointing hand)

SetDivider(value)

The SetDivider() method sets the index or identifier/key/caption or reference of the cell that's single displayed by the item
Parameters:
Name Type Description
value any Specifies the new item's divider
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)

SetEnabled(value)

The SetEnabled() method enables or disables the item
Parameters:
Name Type Description
value boolean Indicates a boolean expression that specifies whether the item is enabled or disabled
Example
false {boolean}, disables the item
 true {boolean}, enables the item

SetExpanded(value)

The SetExpanded() method expands or collapses the item.
Parameters:
Name Type Description
value boolean Specifies whether the item is expanded or collapsed
Example
false {boolean}, the item is collapsed
 true {boolean}, the item is expanded (item's children are shown)

SetHeight(value)

The SetHeight() method changes the item's individual height
Parameters:
Name Type Description
value array Specifies the new item's individual height
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

SetKey(value)

The SetKey() method assigns a new key to the item
Parameters:
Name Type Description
value string Specifies a new key to be assigned to the item
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.

SetOptions(oOptions)

The SetOptions() method changes the item's options (visibility, caption, ...) at once
Parameters:
Name Type Description
oOptions object Specifies an object of ItemOptions type that holds information about the item, such as caption, image and so on. If the oOptions parameter is not-of object type it indicates the item's caption instead
Example
oTree.Item(0).Options = {shape: "red", height: 32}, changes the item's height and background
 oTree.Item(0).SetOptions({shape: "red", height: 32}), changes the item's height and background

SetParent(value) → {boolean}

The SetParent() method sets the item's parent
Parameters:
Name Type Description
value any The value parameter can be any of the following:
  • value {number}, indicates a numeric value that defines the index of the parent's item
  • value {string}, specifies a string expression that defines the identifier/key of the parent's item
  • value {Item}, specifies the object reference to the parent's item
Returns:
Returns true, if the item's parent has been changed
Type
boolean
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

SetPosition(value)

The SetPosition() method changes the item's position.
Parameters:
Name Type Description
value number Specifies the item's new position

SetSelectable(value)

The SetSelectable() method defines whether the item is selectable
Parameters:
Name Type Description
value boolean Specifies whether the item is selectable
Example
false {boolean}, the item is unselectable
 true {boolean}, the item is selectable

SetSelected(value)

The SetSelected() method defines whether the item is selected
Parameters:
Name Type Description
value boolean Specifies whether the item is selected
Example
false {boolean}, the item is unselected
 true {boolean}, the item is selected

SetShape(value)

The SetShape() method changes the shape for the item itself.
Parameters:
Name Type Description
value any The value could be any 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.Shape.Tree or exontrol.Shape namespace
  • a CSS color
  • a JSON string-representation of an object of exontrol.Def.Shape type, for the column itself
  • an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type
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.Tree.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)
 exontrol.Shapes.Button {object}, applies the "Button" shape on the object as defined into exontrol.Shapes namespace

SetShowExpand(value)

The SetShowExpand() method specifies whether the item's expand/collapse glyphs is visible or hidden
Parameters:
Name Type Description
value boolean Specifies whether the item's expand/collapse glyphs is visible or hidden
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

SetSortable(value)

The SetSortable() method defines whether the item is sortable
Parameters:
Name Type Description
value boolean Specifies whether the item is sortable
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

SetValue(value)

The SetValue() method changes the value for each cell of the item
Parameters:
Name Type Description
value null | any | Array.<any> Specifies the values for each cell to set
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
 ["<img>al</img>Alexa","<img>dtop</img>Darius"] {string[]}, specifies the captions for the first two-cells (includes images too, The image can be added using the exontrol.HTMLPicture.Add() method)

SetVisible(value)

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

ToggleExpand()

The ToggleExpand() method toggles the item's expand state. For instance, if the item is expanded, the ToggleExpand() method collapses the item.