List

The List is a widget that represents a collection of items in a scrollable list.

Included in: dx.mobile.js, dx.web.js, dx.viz-web.js, dx.all.js
Module: ui/list
Export: default
List interactive configuration
Copy Code
Copy to Codepen
$("#list").dxList({
});

                    

DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.

The following code shows how to create the List widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.

jQuery
JavaScript
HTML
$(function () {
    $("#list").dxList({
        dataSource: [ "Item 1", "Item 2", "Item 3" ],
        searchEnabled: true
    });
});
<div id="list"></div>
Angular
HTML
TypeScript
<dx-list
    [dataSource]="listData"
    [searchEnabled]="true">
</dx-list>
import { DxListModule } from 'devextreme-angular';
// ...
export class AppComponent {
    listData = [ "Item 1", "Item 2", "Item 3" ];
}
@NgModule({
    imports: [
        // ...
        DxListModule
    ],
    // ...
})
AngularJS
HTML
JavaScript
<div ng-controller="DemoController">
    <div dx-list="{
        dataSource: listData,
        searchEnabled: true
    }"></div>
</div>
angular.module('DemoApp', ['dx'])
    .controller("DemoController", function ($scope) {
        $scope.listData = [ "Item 1", "Item 2", "Item 3" ];
    });
Knockout
HTML
JavaScript
<div data-bind="dxList: {
    dataSource: listData,
    searchEnabled: true
}"></div>
var viewModel = {
    listData: [ "Item 1", "Item 2", "Item 3" ]
};
ko.applyBindings(viewModel);
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().List()
    .ID("list")
    .DataSource(new[] { "Item 1", "Item 2", "Item 3" })
    .SearchEnabled(true)
)
@(Html.DevExtreme().List() _
    .ID("list") _
    .DataSource({ "Item 1", "Item 2", "Item 3" }) _
    .SearchEnabled(True)
)
See Also

View Demo

Configuration

An object defining configuration options for the List widget.

Name Description
accessKey

Specifies the shortcut key that sets focus on the widget.

activeStateEnabled

Specifies whether or not the widget changes its state when interacting with a user.

allowItemDeleting

Specifies whether or not an end user can delete list items.

allowItemReordering

Specifies whether a user can reorder list items. Grouped items cannot be moved from one group to another.

bounceEnabled

A Boolean value specifying whether to enable or disable the bounce-back effect.

collapsibleGroups

Specifies whether or not an end-user can collapse groups.

dataSource

A data source used to fetch data to be displayed by the widget.

disabled

Specifies whether the widget responds to user interaction.

elementAttr

Specifies the attributes to be attached to the widget's root element.

focusStateEnabled

Specifies whether the widget can be focused using keyboard navigation.

grouped

Specifies whether data items should be grouped.

groupTemplate

Specifies a custom template for group captions.

height

Specifies the widget's height.

hint

Specifies text for a hint that appears when a user pauses on the widget.

hoverStateEnabled

Specifies whether the widget changes its state when a user pauses on it.

indicateLoading

Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data.

itemDeleteMode

Specifies the way a user can delete items from the list.

itemHoldTimeout

The time period in milliseconds before the onItemHold event is raised.

items

An array of items displayed by the widget.

itemTemplate

Specifies a custom template for items.

keyExpr

Specifies which data field provides keys for widget items.

menuItems

Specifies the array of items for a context menu called for a list item.

menuMode

Specifies whether an item context menu is shown when a user holds or swipes an item.

nextButtonText

The text displayed on the button used to load the next page from the data source.

noDataText

The text or HTML markup displayed by the widget if the item collection is empty.

onContentReady

A handler for the contentReady event. Executed when the widget's content is ready. This handler may be executed multiple times during the widget's lifetime depending on the number of times its content changes.

onDisposing

A handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only.

onGroupRendered

A handler for the groupRendered event.

onInitialized

A handler for the initialized event. Executed only once, after the widget is initialized.

onItemClick

A handler for the itemClick event.

onItemContextMenu

A handler for the itemContextMenu event.

onItemDeleted

A handler for the itemDeleted event.

onItemDeleting

A handler for the itemDeleting event. Executed before an item is deleted from the data source.

onItemHold

A handler for the itemHold event.

onItemRendered

A handler for the itemRendered event.

onItemReordered

A handler for the itemReordered event.

onItemSwipe

A handler for the itemSwipe event.

onOptionChanged

A handler for the optionChanged event. Executed after an option of the widget is changed.

onPageLoading

A handler for the pageLoading event.

onPullRefresh

A handler for the pullRefresh event.

onScroll

A handler for the scroll event.

onSelectAllValueChanged

A handler for the selectAllValueChanged event.

onSelectionChanged

A handler for the selectionChanged event. Raised after an item is selected or unselected.

pageLoadingText

Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom.

pageLoadMode

Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked.

pulledDownText

Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold.

pullingDownText

Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold.

pullRefreshEnabled

A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture.

refreshingText

Specifies the text displayed in the pullDown panel while the list is being refreshed.

rtlEnabled

Switches the widget to a right-to-left representation.

scrollByContent

A Boolean value specifying if the list is scrolled by content.

scrollByThumb

A Boolean value specifying if the list is scrolled using the scrollbar.

scrollingEnabled

A Boolean value specifying whether to enable or disable list scrolling.

searchEditorOptions

Configures the search panel.

searchEnabled

Specifies whether the search panel is visible.

searchExpr

Specifies a data object's field name or an expression whose value is compared to the search string.

searchMode

Specifies a comparison operation used to search widget items.

searchTimeout

Specifies a delay in milliseconds between when a user finishes typing, and the search is executed.

searchValue

Specifies the current search string.

selectAllMode

Specifies the mode in which all items are selected.

selectedItemKeys

Specifies an array of currently selected item keys.

selectedItems

An array of currently selected item objects.

selectionMode

Specifies item selection mode.

showScrollbar

Specifies when the widget shows the scrollbar.

showSelectionControls

Specifies whether or not to display controls used to select list items.

tabIndex

Specifies the number of the element when the Tab key is used for navigating.

useNativeScrolling

Specifies whether or not the widget uses native scrolling.

visible

Specifies whether the widget is visible.

width

Specifies the widget's width.

Methods

This section describes members used to manipulate the widget.

Name Description
beginUpdate()

Prevents the widget from refreshing until the endUpdate() method is called.

clientHeight()

Gets the widget's height in pixels.

collapseGroup(groupIndex)

Collapses a group with a specific index.

defaultOptions(rule)

Specifies the device-dependent default configuration options for this component.

deleteItem(itemElement)

Removes an item found using its DOM node.

deleteItem(itemIndex)

Removes an item with a specific index.

dispose()

Disposes of all the resources allocated to the List instance.

element()

Gets the root widget element.

endUpdate()

Refreshes the widget after a call of the beginUpdate() method.

expandGroup(groupIndex)

Expands a group with a specific index.

focus()

Sets focus on the widget.

getDataSource()

Gets the DataSource instance.

getInstance(element)

Gets the instance of a widget found using its DOM node.

instance()

Gets the widget's instance. Use it to access other methods of the widget.

isItemSelected(itemElement)

Checks whether an item found using its DOM node is selected.

isItemSelected(itemIndex)

Checks whether an item with a specific index is selected.

off(eventName)

Detaches all event handlers from a single event.

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

on(eventName, eventHandler)

Subscribes to an event.

on(events)

Subscribes to events.

option()

Gets all widget options.

option(optionName)

Gets the value of a single option.

option(optionName, optionValue)

Updates the value of a single option.

option(options)

Updates the values of several options.

registerKeyHandler(key, handler)

Registers a handler to be executed when a user presses a specific key.

reload()

Reloads list data.

reorderItem(itemElement, toItemElement)

Reorders items found using their DOM nodes.

reorderItem(itemIndex, toItemIndex)

Reorders items with specific indexes.

repaint()

Repaints the widget. Call it if you made modifications that changed the widget's state to invalid.

scrollBy(distance)

Scrolls the content by a specified distance.

scrollHeight()

Gets the content's height in pixels.

scrollTo(location)

Scrolls the content to a specific position.

scrollToItem(itemElement)

Scrolls the content to an item found using its DOM node.

scrollToItem(itemIndex)

Scrolls the content to an item with a specific index.

scrollTop()

Gets the top scroll offset.

selectAll()

Selects all items.

selectItem(itemElement)

Selects an item found using its DOM node.

selectItem(itemIndex)

Selects an item with a specific index.

unselectAll()

Cancels the selection of all items.

unselectItem(itemElement)

Cancels the selection of an item found using its DOM node.

unselectItem(itemIndex)

Cancels the selection of an item with a specific index.

updateDimensions()

Updates the widget scrollbar according to widget content size.

Events

This section describes events fired by this widget.

Name Description
contentReady

Raised when the widget's content is ready.

disposing

Raised when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only.

groupRendered

Fires after an item group element is rendered.

initialized

Raised only once, after the widget is initialized.

itemClick

Fires when a list item is clicked.

itemContextMenu

Fires when the right mouse button is clicked when the pointer is over a widget item, or when the "sustained" (also known as a long press) touch action is performed.

itemDeleted

Fires when a widget item is deleted.

itemDeleting

Raised before an item is deleted from the data source.

itemHold

Fires when the widget's collection item is being held for the time period specified by the itemHoldTimeout option.

itemRendered

Fires after a collection item is rendered.

itemReordered

Fires when a list item is moved to another position.

itemSwipe

Fires when an item is swiped.

optionChanged

Raised after a widget option is changed.

pageLoading

Fires before loading the next page when autopaging is enabled.

pullRefresh

Fires before the list is refreshed as a result of the "pull down to refresh" gesture.

scroll

Fires on each scroll gesture.

selectAllValueChanged

Fires when the select all check box value changes.

selectionChanged

Fires after a collection item is selected or unselected.

See Also

Default Item Template

This section lists the data source fields that are used in a default template for list items.

Type:

Object

By default, a predefined item template is applied to display the items of this widget. This template is based on certain fields of the data source provided for this widget. Below is a list of these fields. If the default item template is not appropriate for your task, implement a custom item template based on these or other fields of your data source.

See Also