Rollist class

Rollist(host, oOptionsopt)

new Rollist(host, oOptionsopt)

The ExRollist/JS component is an interactive list control that arranges its items along the path of an ellipse. As users navigate through the list, the selected item is automatically positioned and displayed at the center of the control, ensuring maximum visibility and focus. This layout creates a smooth and visually engaging experience when browsing items.

Features include:

  • Elliptical Layout, items are arranged along an elliptical path for a modern, visually engaging presentation (supports liner arrangement as well)
  • Centered Selection, ihe selected item is always displayed in the center of the control for better visibility and focus
  • Smooth Scrolling & Animation, offers smooth, animated transitions when navigating through items
  • Filter Support, allows users to filter items dynamically as they type characters to match
  • Mouse & Touch Support, fully interactive via mouse wheel and touch gestures such as swipe or drag
  • Customizable Items, items can include rich HTML content, images, or custom styles
  • Keyboard Navigation, allows users to navigate the list using keyboard input (e.g., arrow keys)
  • Lightweight & Fast, designed for performance, even with large numbers of items
  • Responsive Design, automatically adapts to the size of its container for flexible integration
The ExRollist/JS is a HTML standalone-component, written in JavaScript, that uses no third-party libraries.

Every option of the Rollist.Options type has associated a property of the control. For instance, the option:

allowActions {string}, customizes the actions the user can perform once the user clicks or touches the control
is associated with the property:
AllowActions {string}, customizes the actions the user can perform once the user clicks or touches the control
which means that the following statements are equivalent:
oRollist.Options = {allowActions: "scroll"}
oRollist.SetOptions({allowActions: "scroll"})
oRollist.AllowActions = "scroll"
oRollist.SetAllowActions("scroll")
where oRollist is an object of Rollist type
Parameters:
Name Type Attributes Description
host any The host parameter specifies the HTML element hosting the control. It can be one of the following:
  • {string}, specifies the identifier of the document element hosting the control
  • {HTMLElement}, indicates the actual document element hosting the control
When the HTML element hosts the control, it automatically receives the class name 'exrollist'. Each item displayed within the control is assigned the class name 'exrolitem', and the item that is currently selected will have the class name 'selected'. You can use the following class names to customize the appearance of different elements within the control:
  • exrollist, this is the class name for the HTML element that serves as the container or host for the entire control. It wraps the entire control and holds all items.
  • exrolitem, this is the class name for each individual item within the control. It applies to the HTML elements that represent each item listed in the control's tagName field specifies the type of HTML element to be created for hosting the item. The ItemOptions.className field of the item defines any additional class names to be applied to the HTML element, allowing for further customization of its styling.
  • selected', this is the additional class name applied to the currently selected item (exrolitem). The selected item is always positioned at the center of the control, making it the focal point of the interaction. You can use the selectPos field to define the vertical ratio for where the selected item is displayed, ranging from -1 (top) to 1 (bottom), with 0 indicating the center
Additionally, the control supports the following classes:
  • exrolfilter, this is the class name for the HTML element that contains the control's filter. The filter allows the user to match typed characters. By default, the filter consists of a label, an input element, and a span. The label is used to specify a description, such as "Filter For...", the input (of type text-box) holds the filter pattern, and the span displays the close button. The structure is: "<label for='rofilter'></label><input type='textbox' id='rofilter'><span>&#10006;</span>". For example, the CSS rule ".exrolfilter label::after { content: 'Filter for: '; color: gray; }" shows "Filter For..." in gray to the left of the input. The AllowFilterInput property specifies whether the control displays a filter bar, enabling the user to filter items by typing text.
  • exroloccur, this is the class name for the SPAN element that highlights matching patterns within the items, allowing customization. By default, the highlight appears with a yellow background.
  • hidden, this is the class name used to hide HTML elements. By default, the CSS rule is {display: none;}
oOptions object <optional>
An object of Rollist.Options type that defines different options to display the control.
Requires:
  • module:exontrol.commmon.min.js

Requires

  • module:exontrol.commmon.min.js

Classes

Options

Members

(static, readonly) AllowFilterInputEnum :number

The Rollist.AllowFilterInputEnum type defines the options and flags that control the visibility of the filter input in the control. The AllowFilterInput property of the control accepts values from this enumeration to specify whether the filter input is displayed and how it behaves. For example, setting AllowFilterInput to exShowOnAnyKey will display the filter input when the user presses any key, allowing for dynamic filtering of items based on user input. Additionally, you can combine flags such as exDisableHighlightOccurences with other options to customize the filtering behavior further, such as disabling the highlighting of matching text within items.

Each AllowFilterInputEnum property can be specified in one of the following ways:

  • A numeric value.
  • A single enumeration constant.
  • A combination of one or more compatible enumeration constants, separated by the | operator.
  • A case-insensitive partial string containing one or more comma-separated names that match the enumeration constants.

For instance, the string "key,disable" is equivalent to the numeric value 18, or to the combination of enumeration constants exShowOnAnyKey | exDisableHighlightOccurences.

Type:
  • number
Properties:
Name value Type Description
exHide 0 number No filter input is visible
exAlwaysVisible 1 number The filter input is always visible, the close button is not displayed
exShowOnAnyKey 2 number Displays the filter input when the user presses a key, along with a close button. Requires the HTML element hosting the control to include the tabindex attribute to receive keyboard focus.
exDisableHighlightOccurences 16 number Disables the highlighting of all occurrences of the typed text within the items, which otherwise helps users visually identify matching content.

(static, readonly) type :string

The type field holds the full name of the object, since constructor.name can differ in minimized or obfuscated code. This field is never altered by the control itself, so it can be reliably used to verify the object's type. It is particularly useful when multiple versions of a control exist or when you need to check the type without depending on constructor.name, which may be inconsistent in some scenarios, such as minified code. The Rollist.type member always returns "Rollist"
Type:
  • string
Example
console.log(exontrol.Rollist.type); // logs "Rollist"

(static, readonly) version :string

The version field defines the version of the control. Each release of the control has a different version number, so you can use this field to check the control's version and ensure that it supports the features you want to use. The version field is especially useful when you have multiple versions of the control, or when you want to check the version of the control without relying on other properties or methods that may differ between versions. The current version is 5.4
Type:
  • string
Example
console.log(exontrol.Rollist.version); // displays the version of the control, for instance "5.2"

AllowActions :string

The AllowActions property customizes the actions the user can perform once the control is clicked or touched. The order of the actions is very important, as the control checks each action from left to right until it finds a matching action for the performed mouse/touch event. The first matched action is performed, and the rest of the actions are ignored. So if you want to perform a specific action once the user clicks an item, and perform another action if the user clicks an area that does not contain any item, you should place the first action before the second one in the AllowActions property.

The format of the property is:

"action(shortcut,shortcut,...),action(shortcut,shortcut,...)..."
where
  • "action", defines the action to perform (as defined below)

    Action Description Flags
    "scroll" Scrolls the control by drag and drop

  • "shortcut", defines the event's button or/and the modifier-keys that are required to perform the action. The "shortcut" is a combination of none, one or more of the following values:
    • "Shift", indicates that the SHIFT key is pressed
    • "Ctrl" or "Control", indicates that the CTRL key is pressed
    • "Alt" or "Menu", indicates that the ALT key is pressed
    • "Meta" , indicates that the META key is pressed
    • "LButton", specifies that the mouse's left-button is pressed
    • "RButton", specifies that the mouse's right-button is pressed
    • "MButton", specifies that the mouse's middle/wheel-button is pressed
    • "Long", specifies that the action requires a "long" click or touch before it begins
    • "Double", specifies that the action requires a "double" click before it begins (this flag is available for non-dragable actions only such as "edit")
    • "+", indicates AND between values
Type:
  • string
Example
null {null}, indicates the control's default allowActions value
"" {string}, specifies that no operation is allowed once the user clicks or touches the control
"scroll" {string}, specifies that only "scroll" operation is allowed, no matter of the event's button or modifier-keys is pressed.
AllowActions

AllowFilterInput :Rollist.AllowFilterInputEnum

The AllowFilterInput property configures whether the control displays a filter bar, allowing users to filter items by typing text. The Filter property defines the filter criteria so that only items matching the criteria are shown. The filter bar typically includes an input field for entering filter text. The visibility and behavior of the filter input can be customized using the Rollist.AllowFilterInputEnum enumeration, which provides options to always show the filter, show it when the user types, or hide it completely. For example, setting AllowFilterInput to exShowOnAnyKey displays the filter input as soon as the user starts typing, enabling dynamic filtering of items. You can also combine this with exDisableHighlightOccurences to prevent the control from highlighting matching text, creating a cleaner appearance while filtering. By default, the AllowFilterInput property is set to exHide, meaning the filter input is not visible until an action triggers its display (if configured to do so). The ShowFilterInput() method displays the filter input field, enabling the user to type keywords for filtering items. The CloseFilterInput() method hides the filter input field and clears any applied filter, showing all items again.

The AllowFilterInput property accepts the following values:

  • exHide (0), no filter input is visible
  • exAlwaysVisible (1), the filter input is always visible, without a close button
  • exShowOnAnyKey (2), displays the filter input when the user presses any key, including a close button. Requires the host HTML element to have a tabindex attribute for keyboard focus
  • exDisableHighlightOccurences (0x10), disables the highlighting of all occurrences of the typed text within the items, which otherwise helps users visually identify matching content.
Type:
Example
null {null} or "hide" {string} or exontrol.Rollist.AllowFilterInputEnum.exHide {AllowFilterInputEnum} or 0 {number}, no filter input is visible (by default)
"always" {string} or exontrol.Rollist.AllowFilterInputEnum.exAlwaysVisible {AllowFilterInputEnum} or 1 {number}, indicates that the filter input is always visible
"key,disable" {string} or (exontrol.Rollist.AllowFilterInputEnum.exShowOnAnyKey | exontrol.Rollist.AllowFilterInputEnum.exDisableHighlightOccurences) {AllowFilterInputEnum} or 0x12 {number}, shows the filter input when the user presses any key and disables the highlighting of all occurrences of the typed text in the items
AllowFilterInput

Cyclic :boolean

The Cyclic property configures whether the items are displayed in a continuous loop. By default, the Cyclic property is False, meaning the control does not loop through items. When set to True, navigating past the last item wraps around to the first item, and vice versa, creating a seamless browsing experience. This feature is useful when you want users to scroll continuously through items without hitting a hard stop at the end of the list.
Type:
  • boolean
Example
true {boolean}, the items are displayed in a continuous loop
false {boolean}, the items are not displayed in a continuous loop (by default)
Cyclic

Data :any

The Data property defines the source from which the control imports data in formats such as CSV files, arrays, or FileList objects. The ImportOptions type defines the options used when importing data from a CSV source. The Data property clears the existing items and then calls the control's Import() method to process the new data specified by this method, populating the control's items accordingly. The Data property can accept various types of input, allowing for flexible data loading options. For example, you can provide a string that specifies the URL to a CSV file, directly input CSV-formatted data as a string, use a FileList object to load data from a local file, or pass an array of data to be imported into the control. The Items.Add() method allows adding items one at a time, whereas the Import() method handles importing multiple items at once. The onload event occurs after the control loads or imports data. The onadditem event notifies your application that a new item has been added to the control.

The Data property supports the following types of input:

  • A String expression that specifies the URL to a CSV file (the string includes no eof, eor or str fields of ImportOptions type), such as: "data.csv"
  • A String expression in CSV format (eof, eor or str fields of ImportOptions type define delimiters and text qualifiers to be used in the CSV data), such as: "German\nEnglish\nFrench"
  • An object that includes the "files" member of FileList type (a local file), such as: a drag-and-drop operation to drop a local file into the control can import data from that file
  • An array of data to load, such as: ["German", "English", "French"]
Type:
  • any
Example
"data.txt" {string}, imports data from data.txt file, using separators defined in ImportOptions type
["German", "English", "French"] {array}, imports data from the array
function(){return Array.from(list.children).map(function(oLI) {return oLI.outerHTML;})}() {array}, imports all &lt;li&gt; child elements contained within the &lt;ul&gt; HTML element with the id "list"
Data

Filter :string

The Filter property defines the filter applied to the items, ensuring that only items matching the filter criteria are shown. The filter can be defined as a string representing the text to match against the items' content. When a filter is applied, the control evaluates each item and displays only those containing the specified text. For example, if you set the Filter property to "icon", the control will display only items that include the word "icon" in their content. Clearing the filter by setting it to null or an empty string will display all items again. The onfilter event notifies your application whenever the user applies or clears filters, such as by typing into the control's filter input, allowing you to respond to changes in filtering criteria. The AllowFilterInput property specifies whether the control displays a filter bar, enabling users to filter items by typing text. The ShowFilterInput() method displays the filter input field, enabling the user to type keywords for filtering items. The CloseFilterInput() method hides the filter input field and clears any applied filter, showing all items again.
Type:
  • string
Example
null {null} or "" {string}, clear the filter (if applied)
"icon" {string}, filters the items to display only those that contain the word 'icon'
Filter

(readonly) Items :Items

The Items property returns the control's items collection. The items collection is represented as an object of Items type, which provides methods and properties to manage the items in the control. The Item() method of the Items collection (equivalent of Rollist.Item property) allows you to retrieve a specific item based on its index or identifier/key. The Count property of the Items collection gets the number of items currently in the control. The feI() method of the control allows you to enumerate the items in the control and get both the item and its index.
Type:
Example
The following statements are equivalents:

 oRollist.GetItems() {Items}, returns the control's items
 oRollist.Items {Items}, returns the control's items

where oRollist is an object of Rollist type
Items

Listeners :exontrol.Lts

The Listeners field defines the items of the control, as an object of exontrol.Lts type. The exontrol.Lts type supports forEach(callback, thisArg) method that helps you to enumerate the items the control supports. The Items section lists the items the component supports.
Type:
  • exontrol.Lts
Example
The following sample shows how you can get all items the component currently supports:

oRollist.Listeners.forEach(function(name)
{
 console.log(name);
});

The following samples handle the "onload" event:

oRollist.Listeners.Add("onload", function (oEvent)
{
 console.log(oEvent);
});

or

oRollist.on("load", function (oEvent)
{
 console.log(oEvent);
});

where oRollist is an object of Rollist type
Listeners

Misc :MiscellaneousOptions

The Misc property configures the control's miscellaneous options. The miscellaneous options include various settings that affect the control's behavior and appearance, such as "selectPos" (the position of the selected item on the elliptic path), "gradualOpacityTransition" (indicates whether to apply gradual opacity transition for items during layout changes), and others. By configuring these options, you can customize how the control responds to user interactions and how it displays its items.

It is important to note that changing a field of the MiscellaneousOptions object does not automatically update the control. For example, oRollist.Misc.hAlign = 1 does not apply the change. Instead, you must assign the Misc property again, such as oRollist.Misc = {hAlign: 1}, so the control updates and applies the new value.

Type:
Example
{hAlign: 1} {object}, changes the horizontal alignment of the items to center-alignment
{selectPos: 0.5} {object}, changes the position of the selected item to the middle of the elliptic path (instead of the default position, which is at the beginning of the elliptic path)
{gradualOpacity: "1 - 0.25"} {object}, applies gradual opacity transition for items
Misc

Options :Rollist.Options

The Options property defines the options to apply to the control. These options allow you to customize the control's behavior and appearance. You can assign options to a control by setting the Options property directly, which provides a programmatic way to update one or more options at runtime. The options are merged with the control's existing options, meaning that only the specified options are updated while the others remain unchanged. For example, if you want to change the wheelChange option without affecting other settings, you can set it like this: oRollist.Options = {wheelChange: 5}. This will update the wheelChange option to 5 while keeping all other options intact.

Every option of the Rollist.Options type has associated a property of the control. For instance, the option:

allowActions {string}, customizes the actions the user can perform once the user clicks or touches the control
is associated with the property:
AllowActions {string}, customizes the actions the user can perform once the user clicks or touches the control
which means that the following statements are equivalent:
oRollist.Options = {allowActions: "scroll"}
oRollist.SetOptions({allowActions: "scroll"})
oRollist.AllowActions = "scroll"
oRollist.SetAllowActions("scroll")
where oRollist is an object of Rollist type

It is important to note that changing a field of the Options object does not automatically update the control. For example, oRollist.Options.allowActions = "scroll" does not apply the change. Instead, you must assign the Options property again, such as oRollist.Options = {allowActions: "scroll"}, so the control updates and applies the new value.

Type:
Example
{allowActions: "scroll", wheelChange: 5} {object}, changes the actions and the weel change for the control
{imageAlign: 1, imageSize: 24} {object}, changes the alignment and the size for all images within the control
Options

Select :Item

The Select property defines the position of the item to select, which is always displayed at the center of the control. It can accept either a number or a string. Assigning a number selects the item based on its position in the Items collection (0-based index); for example, setting Select to 0 selects the first item, and setting it to 1 selects the second item. Assigning a string selects the item based on its identifier or key; for instance, if an item has the identifier "itemId", setting Select to "itemId" selects that specific item. The onselect event notifies your application when a user selects an item at runtime by clicking it. The onselect event is raised when the selected item changes, either through user interaction or programmatically by calling the Select property. This event allows you to execute custom code in response to item selection changes, such as updating other parts of your application based on the newly selected item.

The Select property supports the following types of values:

  • {number}, specifies the position of the item to select
  • {string}, specifies the identifier/key of the item to select
  • {Item}, indicates the item to select
Type:
Example
0 {number}, selects the first item in the Items collection
"itemId" {string}, selects the item with the identifier/key "itemId"
Select

Smooth :number

The Smooth property defines the time in ms the control goes from one layout to another. Setting the Smooth property to 0 means that no smooth changes are performed once the control goes from a layout to another. Setting the Smooth property to 125 means that a smooth-transition is performed from a layout to another for 125 ms. The Smooth() method smoothly transitions the control from the current layout to a new layout, applying gradual changes rather than an immediate switch.
Type:
  • number
Example
0 {number}, no smooth changes once the control goes from a layout to another
125 {number}, specifies that a smooth-transition is performed from a layout to another for 125 ms.
Smooth

WheelChange :number

The WheelChange property defines the amount the calendar scrolls when the user rolls the mouse wheel. This setting allows you to adjust the sensitivity of the mouse wheel interaction with the control.
  • Setting wheelChange to 0 disables mouse wheel actions, preventing the control from changing when the wheel is scrolled
  • Setting wheelChange to a positive number, such as 5, increases the control's value by that amount each time the wheel is rotated, enabling faster adjustments

By modifying this value, you can fine-tune the control's responsiveness, making it easier for users to perform precise changes or larger adjustments as needed.

Type:
  • number
Example
0 {number}, locks any action the mouse's wheel performs
18 {number}, scrolls the control by 18-pixels when mouse's wheel is rotated (CTRL + wheel scrolls horizontally)
WheelChange

Methods

BeginUpdate()

The BeginUpdate() method suspends the control's render until the EndUpdate() method is called. It maintains performance, while multiple changes occurs within the control. The BeginUpdate() method is mostly used when you want to perform multiple changes to the control without refreshing the control after each change, and once all changes are performed, you can call the EndUpdate() method to refresh the control. You can use the Update() method to perform multiple changes at once. The Smooth() method makes the control transition smoothly from the current layout to a new layout. In short, it applies a gradual, animated change to the layout generated by the callback, instead of switching instantly. The BeginUpdate/EndUpdate() methods are not required to be called when you use the Update() or Smooth() methods, because the methods already maintain performance while performing multiple changes to the control.
Example
oRollist.BeginUpdate();
  // performs multiple changes to the control
oRollist.EndUpdate();
BeginUpdate

CloseFilterInput()

The CloseFilterInput() method hides and clears the filter input field, effectively removing it from view and disabling the filtering functionality. It also clears any active filter. The filter bar is typically displayed at the top of the control and includes an input field for entering filter text and may also include a close button to clear the filter. When the user types into the filter input, the control applies the specified filter criteria to the items, showing only those that match. For example, if the user types "icon" into the filter input, only items containing the word "icon" will be displayed. The onfilter event notifies your application whenever the user applies or clears filters, allowing you to respond to changes in filtering criteria. The Filter property defines the filter applied to the items, ensuring that only items matching the filter criteria are shown. The AllowFilterInput property specifies whether the control displays a filter bar, enabling users to filter items by typing text. The ShowFilterInput() method displays the filter input field, enabling the user to type keywords for filtering items.
Example
oRollist.CloseFilterInput(), hides the filter input field and clears any applied filter, showing all items again
CloseFilterInput

EndUpdate()

The EndUpdate() method resumes the control's render, after it is suspended by the BeginUpdate() method. The EndUpdate() method is mostly used after calling the BeginUpdate() method, to refresh the control after performing multiple changes to the control. You can use the Update() method to perform multiple changes at once. The Smooth() method makes the control transition smoothly from the current layout to a new layout. In short, it applies a gradual, animated change to the layout generated by the callback, instead of switching instantly. BeginUpdate/EndUpdate() methods are not required to be called when you use the Update() or Smooth() methods, because the methods already maintain performance while performing multiple changes to the control.
Example
oRollist.BeginUpdate();
 // performs multiple changes to the control
oRollist.EndUpdate();
EndUpdate

Import(source, importOptsopt)

The Import() method imports data from CSV format. The Data property provides an alternative way to import data, but using the Import() method allows you to specify additional options through the importOpts parameter. The Items.Add() method allows adding items one at a time, whereas the Import() method handles importing multiple items at once. The Import method does not clear the existing items before importing new data. If you want to clear existing items, you can use the Items.Clear() method before calling Import(). The onload event occurs after the control loads or imports data. The onadditem event notifies your application that a new item has been added to the control.
Parameters:
Name Type Attributes Description
source any The source parameter may be one of the following:
  • A String expression that specifies the URL to a CSV file (the string includes no eof, eor or str fields of ImportOptions type), such as: "data.csv"
  • A String expression in CSV format (eof, eor or str fields of ImportOptions type define delimiters and text qualifiers to be used in the CSV data), such as: "German\nEnglish\nFrench"
  • An object that includes the "files" member of FileList type (a local file), such as: a drag-and-drop operation to drop a local file into the control can import data from that file
  • An array of data to load, such as: ["German", "English", "French"]
importOpts object <optional>
The importOpts parameter specifies options to import data into the control as object of ImportOptions type.
Properties
Name Type Description
limit number specifies the maximum number of rows/items/lines to import.
format string determines the format of source to import data from.
eor string | RegExp specifies the delimiter, which can be a character, string, or regular expression (@since 4.4), used to identify the end of a row, item, or line during parsing (has effect only if format field is "CSV").
eof string specifies the character to separate fields within the row/item/line (has effect only if format field is "CSV").
str string specifies the character to quote values (has effect only if format field is "CSV").
hdr boolean indicates whether the first line in data represents the control's header (has effect only if format field is "CSV").
Example
Import("data.csv"), imports data from the "data.csv" file located on the same server as the webpage
Import("German\nEnglish\nFrench", {format: "CSV", eor: "\n"}), imports data from a CSV string with newline as the end-of-row delimiter
Import(["German", "English", "French"]), imports data from an array of strings
Import

Item(id) → {Item}

The Item() method returns the item based on its index or identifier/key. The Item(id) method is equivalent with Rollist.Item(id) method of the control. The ItemByPos() method retrieves an item based on its position within the Items collection. The Items.Count property gets the number of items currently in the control. The feI() method of the control allows you to enumerate the items in the control and get both the item and its index.
Parameters:
Name Type Description
id any The item parameter could be any of the following:
  • item {number}, indicates a numeric value that defines the index of the item to request
  • item {string}, specifies a string expression that defines the identifier/key of the item to request
  • item {Item}, specifies the object reference to the item to request for
Returns:
Returns null or an object of Item type
Type
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

ItemByPos(pos) → {Item}

The ItemByPos() method retrieves an item based on its position within the Items collection (not to be confused with the Item() method, which retrieves an item by its index or key). The position is a zero-based value that reflects the item’s order in the collection. Unlike the index or key, an item's position may change when items are rearranged, while its index or identifier remains unchanged. For example, the first item has position 0, the second has position 1, and so on. The Item.Position property indicates an item's current position and is automatically updated when items are added, removed, or reordered. The Items.Count property returns the total number of items in the control. Additionally, the feI() method allows you to enumerate the items in the control, providing access to both the item and its index.
Parameters:
Name Type Description
pos number The zero-based index of the item to retrieve.
Since:
  • 5.4
Returns:
The item at the specified position, or undefined if the position is invalid
Type
Item
Example
The following statements are equivalent:

 oRollist.ItemByPos(0) {Item}, returns the first item by its position in the Items collection
 oRollist.ItemByPos(1) {Item}, returns the second item by its position in the Items collection

where oRollist is an object of Rollist type.
ItemByPos

Refresh()

The Refresh() method forces the control to redraw and update its layout without modifying any of its properties or data. It is typically used when the visual appearance needs to be recalculated or repainted, even though no structural or state changes were made.

For example, call Refresh() when:

  • The control's container has been resized and the layout must be recalculated.
  • External CSS or styling changes affect the control's appearance.
  • The control becomes visible after being hidden.
  • You need to ensure the UI is visually synchronized with its current internal state.

The method does not alter the control's data, options, or configuration - it only updates the rendered output.

Example
oRollist.Refresh(), refreshes the control
Refresh

ShowFilterInput()

The ShowFilterInput() method displays the filter input field, enabling the user to type keywords for filtering items. The filter bar is typically displayed at the top of the control and includes an input field for entering filter text and may also include a close button to clear the filter. When the user types into the filter input, the control applies the specified filter criteria to the items, showing only those that match. For example, if the user types "icon" into the filter input, only items containing the word "icon" will be displayed. The onfilter event notifies your application whenever the user applies or clears filters, allowing you to respond to changes in filtering criteria. The Filter property defines the filter applied to the items, ensuring that only items matching the filter criteria are shown. The AllowFilterInput property specifies whether the control displays a filter bar, enabling users to filter items by typing text. The CloseFilterInput() method hides the filter input field and clears any applied filter, showing all items again.
Example
oRollist.ShowFilterInput(), displays the filter input field, allowing the user to type keywords for filtering items
ShowFilterInput

Update(callback, thisArgopt)

The Update() method locks the control's paint during the callback, and invalidates the control once the method ends. The BeginUpdate/EndUpdate() methods are not required to be called when you use the Update() or Smooth() methods, because the methods already maintain performance while performing multiple changes to the control. The BeginUpdate/EndUpdate() methods are not required to be called when you use the Update() or Smooth() methods, because the methods already maintain performance while performing multiple changes to the control.
Parameters:
Name Type Attributes Description
callback callback Indicates a callback to perform changes within the control.
thisArg any <optional>
Specifies the value of "this" keyword during the callback. If missing/empty/undefined the thisArg points to the control itself, as an object of Rollist type.
Example
oRollist.Update(function()
{
 // performs multiple changes to the control
});
Update

feI(callback, thisArgopt)

The feI() method (short for forEachItem) method invokes the callback for each item of the control. The feIU() (short for forEachItemUnit) invokes the callback for each item of the control, until the callback returns a truly value. You can also use the Rollist.Item and Items.Count properties to loop through the items of the control.
Parameters:
Name Type Attributes Description
callback callback A function of callback(oItem) type that's called for every item, where oItem is:
  • oItem {Item}, specifies an item of Item type
thisArg any <optional>
Indicates the value of "this" keyword during the callback. If missing/empty/undefined the thisArg points to the control itself, as an object of Rollist type.
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.
feI

feIU(callback, thisArgopt) → {any}

The feIU() (short for forEachItemUnit) invokes the callback for each item of the control, until the callback returns a truly value. The feI() method (short for forEachItem) method invokes the callback for each item of the control. You can also use the Rollist.Item and Items.Count properties to loop through the items of the control.
Parameters:
Name Type Attributes Description
callback callback A function of callback(oItem) {any} type that's called for every item, where oItem is
  • oItem {Item}, specifies an item of Item type
thisArg any <optional>
Indicates the value of "this" keyword during the callback. If missing/empty/undefined the thisArg points to the control itself, as an object of Rollist type.
Returns:
Returns the last-value of the callback
Type
any

off(event, listener, methodopt)

The off() method removes a previously bound handler from a specified event, allowing you to stop listening for that event and prevent the associated actions from being executed. Also removes keyboard shortcuts previously defined using the on() method. The event name is case-insensitive and may or may not include the 'on' prefix. For example, 'click' is equivalent to 'onclick' and vice versa. If the event parameter is missing/empty/undefined, all event handlers are removed from the control. If the listener parameter is missing/empty/undefined, all handlers of the specified event are removed. If the method parameter is missing/empty/undefined, the listener[type]() function is used to compare and remove the handler(s).
Parameters:
Name Type Attributes Description
event string Indicates the event to unbind, which can either be:
  • event {string}, the name of the event to unbind. The event name is case-insensitive and may or may not include the 'on' prefix. For example, 'load' is equivalent to 'onload' and vice versa.
  • event {string}, a string that encloses a shortcut in {}, such as "{Ctrl + A}", to unbind the keyboard shortcut
listener object | callback Defines the listener to remove, which can either be:
  • listener {callback}, a JavaScript callback function that was previously bound to the event (the method parameter has no effect)
  • listener {object}, an object that implements a notification method (e.g., listener[method](oEvent) or listener[type](oEvent)) that was previously used to handle the event
method string <optional>
Defines an optional case-sensitive string specifying the method on the listener to remove. If not provided, the listener[type]() function is used. This parameter is ignored when the listener is a JavaScript callback function.
Since:
  • 4.4
Example
The following example removes the load event handler from the control:

oRollist.off("load");

where oRollist is an object of Rollist type.

This sample is equivalent to:

oRollist.Listeners.Remove("onload");

The following example removes all event handlers from the control:

oRollist.off();

where oRollist is an object of Rollist type.

This sample is equivalent to:

oRollist.Listeners.Clear();

or

oRollist.Listeners.Remove();
off

on(event, listener, methodopt) → {object}

The on() method adds an event listener to the specified event or defines a keyboard shortcut. The on() method enables you to listen for events and execute custom code when those events occur, or to define keyboard shortcuts that trigger specific actions within the component. You can use the on() method to enhance the interactivity and functionality of your application by responding to user actions or keyboard inputs. Use the off() method to remove previously bound event handlers or keyboard shortcuts.
Parameters:
Name Type Attributes Description
event string Specifies the event to listen for or a keyboard shortcut, in one of the following forms:
  • If the value is in the "{shortcut}" form (for example, "{Ctrl + A}"), it defines a keyboard shortcut. The callback is triggered when that key combination is pressed. To provide keyboard support for the component, the <canvas> element that hosts it needs to be focusable. To achieve this, you must include the tabIndex attribute in the canvas HTML tag (for example, <canvas tabIndex="0"></canvas>).

    See Shortcuts for more information. (for example, on("{Ctrl + A}", callback)). The shortcut-feature for on/off methods is supported from version 5.0.

  • Otherwise, the value is treated as a standard event name (for example, "load"), and the callback is invoked when that event occurs on the component. The event name is case-insensitive and may or may not include the 'on' prefix. For example, 'load' is equivalent to 'onload' and vice versa.

    See Listeners for more information. (for example, on("load", callback)).

listener object | callback Defines the listener to add, which can either be:
  • listener {callback}, a JavaScript callback function to handle the event directly (the method parameter has not effect)
  • listener {object}, an object that implements a notification method (e.g., listener[method](oEvent) or listener[type](oEvent)) to handle the event when it occurs
method string <optional>
Defines an optional case-sensitive string specifying the method on the listener to handle the event. If not provided, the listener[type]() function is used. This parameter is ignored when the listener is a JavaScript callback function.
Since:
  • 4.4
Returns:
Returns the listeners of the specified type, as an exontrol.Arr({callback, thisArg, lock, name, equal}) type, which includes the following new members:
  • type {string}, specifies a case-sensitive string that specifies the type of event to listen for
  • do(event) {callback}, indicates a function that can be invoked to trigger the specified event for all listeners registered for that event type
where:
  • callback {callback}, defines the listener's callback function
  • thisArg {any}, defines the value of this during the listener's callback execution
  • lock {number}, locks or unlocks the invocation of the listener's callback
  • name {string}, defines the name of the callback, mostly used for debugging purposes
  • equal(oCompareListenerCallback) {callback}, indicates a function of callback(oCompareListenerCallback) {boolean} type compares the current object with the provided object. It returns true if the objects contain the same data
Type
object
Example
The following sample shows how you can handle the onload event:

oRollist.on("load", function()
{
  console.log("onload event occured");
});

where oRollist is an object of Rollist type.

This sample is quivalent of 

oRollist.Listeners.Add("onload", function ()
{
  console.log("onload event occured");
});
on

Events

onadditem

The onadditem event notifies your application that a new item has been added to the control. You can use the onadditem event to perform additional operations once an item is added to the control, such as setting additional properties for the item. The Items.Add() method triggers the onadditem event after adding a new item to the control. In the same manner the Import or Data method triggers the onadditem event for each item being added to the control. The oncreate event occurs once an HTML element is created and linked to a visible item.

Please pay attention: if items are loaded through the data field using hardcoded values (such as strings or arrays, rather than files that require loading time) during control initialization, the onadditem event is not triggered because the event handler has not yet been assigned.

Parameters:
Name Type Description
oItem Item Indicates an object of Item type being added.
Example
The following samples display the item being added:

oRollist.onadditem = function (oItem)
{
 console.log(oItem);
}

or

oRollist.Listeners.Add("onadditem", function (oItem)
{
 console.log(oItem);
})

or

oRollist.on("additem", function (oItem)
{
 console.log(oItem);
})

where oRollist is an object of Rollist type
onadditem

onclick

The onclick event occurs once the user clicks or double-clicks the control. The onselect event notifies your application once the user selects a new item. The onclick event occurs before the onselect event when the user clicks an item to select it. You can use the onclick event to perform additional operations once an item is clicked, such as displaying additional information for the clicked item. The onclick event is triggered before the selected item has been changed and before the control has been updated to reflect the new selection. The onselect event occurs after the selected item has been changed and the control has been updated to reflect the new selection.
Parameters:
Name Type Description
oEvent object specifies an object of {dblClick,button,modifiers,item,html} type, that holds information about the object being clicked.
Properties
Name Type Description
item Item specifies undefined or an object of Item type that indicates the clicked item.
html HTMLElement specifies undefined or an object of HTMLElement type that indicates the HTML element associated with the clicked item.
dblClick boolean indicates whether the user clicks or double-clicks the item.
button number indicates which button is pressed while clicking the item as 1 (left), 2 (right) or 4 (middle).
modifiers number specifies a combination of 1, 2, 4 and 16 according with modifier keys (ALT, CTRL, META and SHIFT), or 0 if no modifier keys.
Example
The following samples show how you can handle the "click" event:

oRollist.Listeners.Add("onclick", function (oEvent)
{
 console.log(oEvent);
})

or

oRollist.on("click", function (oEvent)
{
 console.log(oEvent);
})

or

oRollist.onclick = function (oEvent)
{
 console.log(oEvent);
}

where oRollist is an object of Rollist type.
onclick

oncreate

The oncreate event occurs when an HTML element is created and linked to a visible item. You can use this event to assign additional properties or configure the newly created element. The oncreate event is triggered for each visible item in the control, such as when items are added, removed, or when a filter is applied. It may be triggered multiple times for the same item, for example when the item's HTML element re-enters the visible area of the control (such as when scrolling with the mouse wheel) or after filtering. The onadditem event occurs when a new item is added to the control, whereas oncreate is triggered when the item's HTML element is created and associated with a visible item. In contrast, the ondestroy event occurs when an HTML element is removed from the DOM, while oncreate is specifically triggered when an element is created and linked to a visible item.
Parameters:
Name Type Description
oEvent oEvent Defines the HTML element being constructed for a visible item, represented as an object with properties: {item,html}, where item is of type Item and html is of type HTMLElement.
Properties
Name Type Description
item Item Specifies the item for which the HTML element is generated.
html HTMLElement Indicates the HTML element associated with the item.
Example
The following samples sets the HTML element's tooltip:

oRollist.oncreate = function (oEvent)
{
 oEvent.html.title = oEvent.html.innerText;
}

or

oRollist.Listeners.Add("oncreate", function (oEvent)
{
 oEvent.html.title = oEvent.html.innerText;
})

or

oRollist.on("create", function (oEvent)
{
 oEvent.html.title = oEvent.html.innerText;
})

where oRollist is an object of Rollist type
oncreate

ondestroy

The ondestroy event occurs when the associated HTML element is removed from the DOM. It may be triggered multiple times, for example when the item's HTML element moves outside the visible area of the control (such as when scrolling the list with the mouse wheel) or when a filter is applied. You can use this event to perform cleanup operations after the element is removed from the DOM, such as releasing additional properties associated with the item. The onremoveitem event occurs when an item is removed from the Items collection, whereas the ondestroy event is triggered specifically when the item's associated HTML element is removed from the DOM. The oncreate event occurs when an HTML element is created and linked to a visible item.
Parameters:
Name Type Description
oEvent oEvent Defines the {item,html} object representing the HTML element to be removed, which was created for a visible item.
Properties
Name Type Description
item Item Specifies the item for which the HTML element is generated.
html HTMLElement Specifies the HTML element associated with the item that is to be removed.
Example
The following samples displays the element being destroyed:

oRollist.ondestroy = function (oEvent)
{
 console.log(oEvent);
}

or

oRollist.Listeners.Add("ondestroy", function (oEvent)
{
 console.log(oEvent);
})

or

oRollist.on("destroy", function (oEvent)
{
 console.log(oEvent);
})

where oRollist is an object of Rollist type
ondestroy

onerror

The onerror event occurs once the control encountered an error. The event may occur when Import method or Data property import data that is not well-formed, or when the control encounters an error while loading a file (e.g., due to CORS policy or invalid format). The onload event occurs once the control loads or imports data.
Parameters:
Name Type Description
oEvent object Specifies an object of DOMException (or any other type) that contains details about the error. When using the Import method or the Data property, the oEvent object may be of type ProgressEvent, and error information can be accessed through the oEvent.target property. Most commonly, the issue is a CORS error, in which case oEvent.target.status is 0 and oEvent.target.readyState is 4.
Example
The following samples display the error once it occurs:

oRollist.onerror = function (oEvent)
{
 console.log(oEvent);
}

or

oRollist.Listeners.Add("onerror", function (oEvent)
{
 console.log(oEvent);
})

or

oRollist.on("error", function (oEvent)
{
 console.log(oEvent);
})

where oRollist is an object of Rollist type
onerror

onfilter

The onfilter event notifies your application when the user applies or clears filters, such as by typing into the control's filter input. The onfilter event is triggered after the filter is applied and the visible items are updated accordingly. You can use this event to perform additional operations once a filter is applied or cleared, such as updating other elements of your application based on the current filter. The Filter property holds the current filter string applied to the control, and it is passed as a parameter to the onfilter event handler.
Parameters:
Name Type Description
filter string Indicates the current filter string applied to the control (equivalent of Filter property), which is passed as a parameter to the onfilter event handler. You can use this parameter to perform additional operations based on the current filter, such as updating other elements of your application.
Example
The following samples displays the current filter once the user changes it:

oRollist.Listeners.Add("onfilter", function (oEvent)
{
 console.log(oEvent);
})

or

oRollist.on("filter", function (oEvent)
{
 console.log(oEvent);
})

or

oRollist.onfilter = function (oEvent)
{
 console.log(oEvent);
}

where oRollist is an object of Rollist type.
onfilter

onload

The onload event occurs after the control loads or imports data. Although the event does not provide additional information, it can be used to trigger actions that should run after data is available, such as accessing items loaded from a file or URL, or performing layout adjustments. The onerror event occurs when the control encounters an error.

Please pay attention: if items are loaded through the data field using hardcoded values (such as strings or arrays, rather than files that require loading time) during control initialization, the onload event is not triggered because the event handler has not yet been assigned.

Example
The following samples display a message once the control loads or imports new data (for instance, the user drags and drops a file into the control):

oRollist.onload = function ()
{
 alert("onload");
}

or

oRollist.Listeners.Add("onload", function ()
{
 alert("onload");
})

or

oRollist.on("load", function ()
{
 alert("onload");
})

where oRollist is an object of Rollist type
onload

onremoveitem

The onremoveitem event occurs once an item has been removed from the Items collection. You can use the onremoveitem event to perform additional operations once an item is removed from the control, such as removing additional properties for the item. The Items.Remove() method triggers the onremoveitem event after removing the item from the control. In the same manner the Clear method triggers the onremoveitem event for each item being removed from the control.
Parameters:
Name Type Description
oItem Item Indicates an object of Item type being removed.
Example
The following samples display the item being removed:

oRollist.onremoveitem = function (oItem)
{
 console.log(oItem);
}

or

oRollist.Listeners.Add("onremoveitem", function (oItem)
{
 console.log(oItem);
})

or

oRollist.on("removeitem", function (oItem)
{
 console.log(oItem);
})

where oRollist is an object of Rollist type
onremoveitem

onselect

The onselect event notifies your application once the user selects a new item. The onselect event occurs when the selected item changes, either through user interaction or programmatically by calling the Select property. You can use the onselect event to perform additional operations once an item is selected, such as displaying additional information for the selected item. The onselect event is triggered after the selected item has been changed and the control has been updated to reflect the new selection. The onclick event occurs before the onselect event when the user clicks an item to select it.
Parameters:
Name Type Description
oEvent object Indicates the item being selected as an object of Item type.
Example
The following samples show how you can handle the "select" event:

oRollist.Listeners.Add("onselect", function (oEvent)
{
 console.log(oEvent);
})

or

oRollist.on("select", function (oEvent)
{
 console.log(oEvent);
})

or

oRollist.onselect = function (oEvent)
{
 console.log(oEvent);
}

where oRollist is an object of Rollist type.
onselect