Item class (Rollist)

Item(oItems, oItemOpts)

new Item(oItems, oItemOpts)

The Item object holds the item of the control. The Item(id) method returns the item based on its index or identifier/key.

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

value {string}, defines the value for individual item
is associated with the property:
Value {any}, defines the value for individual item
which means that the following statements are equivalent:
oItem.Options = {value: 100}
oItem.SetOptions({value: 100})
oItem.Value = 100
oItem.SetValue(100)
where oItem is an object of Item type
Parameters:
Name Type Description
oItems Item Indicates an object of Items type that's the owner collection of this item
oItemOpts ItemOptions Specifies the options to apply on the item
Item

Methods

GetClassName() → {string}

The GetClassName() method defines additional class name to apply to the HTML element that hosts the item. By default, the 'exrolitem' class name is applied to the HTML element that hosts the roll item.
Returns:
Returns an additional class name to apply to the HTML element that hosts the item
Type
string
GetClassName

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
GetIndex

GetKey() → {string}

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

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
GetOptions

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
GetPosition

GetValue() → {any}

The GetValue() method defines the value of the item
Returns:
Returns the value(s) of the item
Type
any
GetValue

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
GetVisible

Remove()

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

SetClassName(value)

The SetClassName() method defines additional class name to apply to the HTML element that hosts the item. By default, the 'exrolitem' class name is applied to the HTML element that hosts the roll item.
Parameters:
Name Type Description
value string Specifies the class name to append
Example
null {null} or "" {string}, no extra class name applied
 "red" {string}, appends 'red' to the HTML element's class name, applying the .red style to the item
SetClassName

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 Items.Item("logo") method to request the item giving its key.
SetKey

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
oRollist.Item(0).Options = {shape: "red", height: 32}, changes the item's height and background
 oRollist.Item(0).SetOptions({shape: "red", height: 32}), changes the item's height and background
SetOptions

SetPosition(value)

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

SetValue(value)

The SetValue() method sets the value of the item
Parameters:
Name Type Description
value any Specifies the value of the item
Example
null {null}, resets the caption of the item
 "caption" {string}, defines the plain-caption for the item
 "<img>al</img>Alexa" {string}, defines the html-caption for the item
SetValue

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
SetVisible