new Items(oTree)
The Items object holds a collection of Item type (item of the control). Use the Items/GetItems() method to access the control's items collection.
Parameters:
Name | Type | Description |
---|---|---|
oTree |
Tree | Indicates an object of Tree type that owns the collection |
Methods
Add(oItemOptsopt) → {Item}
The Add() method creates and adds a new item into the control. Use the Add() method of the Item object to a new child-item into the control.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
oItemOpts |
string | object |
<optional> |
Specifies the options to create the new item as an object of ItemOptions type. The value field of the oItemOpts parameter can be of the CellOptions type to define the options (including the value) to apply to the cell (@since 3.2) |
Returns:
Returns the newly created item, as an object of Item type
- Type
- Item
Example
oTree.Items.Add("caption"), adds a new item, and sets the caption for the first cell.
oTree.Items.Add({value: "caption"}), adds a new item, and sets the caption for the first cell.
oTree.Items.Add({value: "caption", shape: "lime"}), adds a new item of lime color and sets the caption for the first cell.
oTree.Items.Add({value: {value: "caption", shape: {tfi: "bold cursive 20"}}, height: 44}), adds a new item of 44px tall, sets the caption and font-attributes for the first cell (@since 3.2)
oTree.Items.Add(["Cell 1","Cell 2"]), adds a new item, and sets the caption for the first and second cell.
oTree.Items.Add({value: ["Cell 1","Cell 2"]}), adds a new item, and sets the caption for the first and second cell.
oTree.EnsureVisibleClient(oTree.Items.Add("caption")), adds a new item, sets the caption for the first cell, and scrolls the control to ensure that the newly item fits the control's client area
Add
Clear()
The Clear() method removes all items of the control and inits the control's scroll-bars
GetCount() → {number}
The GetCount() method returns the number of items within the collection
Returns:
Returns the number of items within the collection
- Type
- number
Example
The following statements are equivalents:
oTree.Items.GetCount(), counts the items within the control
oTree.Items.Count, counts the items within the control
where oTree is an object of Tree type
GetCount
GetLeafCount() → {number}
The GetLeafCount() method counts the leaf-items. A leaf item is an item with no child items.
Returns:
Returns the count of leaf-items.
- Type
- number
Example
The following statements are equivalents:
oTree.Items.GetLeafCount(), counts the leaf-items
oTree.Items.LeafCount, counts the leaf-items
where oTree is an object of Tree type
GetLeafCount
GetMatchCount() → {number}
The GetMatchCount() method returns the number of items that match the filter
Returns:
Returns the number of items that match the filter as explained below:
- 0, the control displays/contains no items, and no filter is applied to any column
- -1, the control displays no items, and there is a filter applied ( no match found )
- positive number, indicates the number of items within the control (Count property)
- negative number, the absolute value minus 1, indicates the number of items that matches the current filter ( match found )
- Type
- number
Example
The following statements are equivalents:
oTree.Items.GetMatchCount(), counts the items that match the filter
oTree.Items.MatchCount, counts the items that match the filter
where oTree is an object of Tree type
GetMatchCount
GetVisibleCount() → {number}
The GetVisibleCount() method returns the number of visible-items
Returns:
Returns the number of visible-items as explained below:
- 0, the control displays/contains no items, and no filter is applied to any column
- -1, the control displays no items, and there is a filter applied ( no match found )
- positive number, indicates the number of visible items, and the control has no filter applied to any column
- negative number, the absolute value munus 1, indicates the number of visible items, and there is a filter applied ( match found )
- Type
- number
Example
The following statements are equivalents:
oTree.Items.GetVisibleCount(), counts the visible items within the control
oTree.Items.VisibleCount, counts the visible items within the control
where oTree is an object of Tree type
GetVisibleCount
Item(id) → {null|Item}
The Item() method gets the item giving its index, identifier/key or reference. The Item(id) method returns the item based on its index or identifier/key (equivalent of this method)
Parameters:
Name | Type | Description |
---|---|---|
id |
any | The id parameter could be any of the following:
|
Returns:
Returns null if the item is not found, or an object of Item type, if the items collection contains the giving id.
- Type
- null | Item
Remove(id)
The Remove() method removes an item from the collection.
Parameters:
Name | Type | Description |
---|---|---|
id |
any | The id parameter could be any of the following:
|
RemoveRange(range) → {number}
The RemoveRange() method removes multiple-items at once
Parameters:
Name | Type | Description |
---|---|---|
range |
any | Indicates an item, an array [{Item}], or an exontrol.Arr([{Item}]) |
Returns:
Returns the number of items being deleted
- Type
- number