Items class (Rollist)

Items(oRollist)

new Items(oRollist)

The Items object holds a collection of Item type (item of the control). Use the Items property to access the control's items collection. The Rollist.Item() method access an item giving its index, identifier/key or reference. The Import() method can be used to import multiple items into the control at once, while the Clear() method removes all items from the control. The Item() method retrieves a specific item based on its index, identifier/key, or reference. The Count property returns the total number of items currently in the collection. To add a new item to the control, use the Add() method, which creates and adds a new item based on the provided options.
Parameters:
Name Type Description
oRollist Rollist Indicates an object of Rollist type that owns the collection.

Members

(readonly) Count :number

The Count property returns the number of items within the collection. The Add, Remove and Clear methods automatically update the count of items within the collection. The Item and Count properties of the collection can be used to enumerate the items within the control. For instance, you can use a loop to iterate through the items by index, using the Count property to determine the number of iterations, and the Item method to access each item by its index. Also, the control provides the feI or feIU method to enumerate the items within the control.
Type:
  • number
Example
The following statements are equivalent:

 oRollist.feI(function(oItem, index)
 {
   console.log(exontrol.ToString.Quote(oItem));
 })

or

 for (var i = 0, l = oRollist.Count; i < l; i++)
   console.log(oRollist.Item(i));

where oRollist is an object of Rollist type.
Count

Methods

Add(oItemOptsopt) → {Item}

The Add() method creates and adds a new item into the control. The Add() method allows adding items one at a time, whereas the Import() method handles importing multiple items at once. The Data property of the control can also be used to add multiple items using different data formats, such as an array of values or a CSV string. The Clear() method can be used to remove all items from the control, providing a way to reset the item collection before adding new items. The Remove method allows for the removal of specific items based on their index, identifier/key, or reference. The onadditem event notifies your application that a new item has been added to the control.
Parameters:
Name Type Attributes Description
oItemOpts 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
oRollist.Item.Add("caption"), adds a new item with the specified caption.
oRollist.Item.Add({value: "caption"}), adds a new item with the specified caption.
Add

Clear()

The Clear() method removes all items of the control. The Clear() method is useful when you want to reset the item collection before adding new items. The Add() method allows for adding items one at a time, while the Import() method can be used to import multiple items into the control at once. The Data property of the control can also be used to add multiple items using different data formats, such as an array of values or a CSV string. The Remove method allows for the removal of specific items based on their index, identifier/key, or reference. The onremoveitem event is triggered for each item that is removed from the Items collection.
Example
Clear(), removes all items from the control
Clear

Item(id) → {null|Item}

The Item() method gets the item giving its index, identifier/key or reference. The Rollist.Item(id) method returns the item based on its index or identifier/key (equivalent of this method). The Item and Count properties of the collection can be used to enumerate the items within the control. For instance, you can use a loop to iterate through the items by index, using the Count property to determine the number of iterations, and the Item method to access each item by its index. Also, the control provides the feI or feIU method to enumerate the items within the control.
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the item to request
  • id {string}, specifies a string expression that defines the identifier/key of the item to request
  • id {Item}, specifies the object reference to the item to request for
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
Example
The following statements are equivalent:

 oRollist.feI(function(oItem, index)
 {
   console.log(exontrol.ToString.Quote(oItem));
 })

or

 for (var i = 0, l = oRollist.Count; i &lt; l; i++)
   console.log(oRollist.Item(i));

where oRollist is an object of Rollist type.
Item

Remove(id)

The Remove() method removes an item from the collection. The Remove(id) method is equivalent with Item.Remove() method, which removes the item itself from items collection. The Remove method allows for the removal of specific items based on their index, identifier/key, or reference. The Clear() method can be used to remove all items from the control, providing a way to reset the item collection before adding new items. The Item() method retrieves a specific item based on its index, identifier/key, or reference. The Count property returns the total number of items currently in the collection. To add a new item to the control, use the Add() method, which creates and adds a new item based on the provided options. The onremoveitem event occurs once an item has been removed from the Items collection.
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the item to request
  • id {string}, specifies a string expression that defines the identifier/key of the item to request
  • id {Item}, specifies the object reference to the item to request for
Example
The following statements are equivalent:

 oRollist.Item.Remove("caption"), removes the item with the specified caption.
 oRollist.Item("caption").Remove(), removes the item with the specified caption.

where oRollist is an object of Rollist type.
Remove

RemoveRange(range)

The RemoveRange() method removes multiple-items at once. The Remove(id) method is equivalent with Item.Remove() method, which removes the item itself from items collection. The Remove method allows for the removal of specific items based on their index, identifier/key, or reference. The Clear() method can be used to remove all items from the control, providing a way to reset the item collection before adding new items. The Item() method retrieves a specific item based on its index, identifier/key, or reference. The Count property returns the total number of items currently in the collection. To add a new item to the control, use the Add() method, which creates and adds a new item based on the provided options.
Parameters:
Name Type Description
range any Indicates an item, an array [{Item}], or an exontrol.Arr([{Item}]).
Example
The following statements are equivalent:

 oRollist.Items.RemoveRange([oItem1, oItem2]), removes oItem1 and oItem2 items at once
 oItem1.Remove(); oItem2.Remove(), removes oItem1 and oItem2 items at once

where oRollist is an object of Rollist type, and oItem1 and oItem2 are objects of Item type.
RemoveRange