React List API
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
$(function () { $("#list").dxList({ dataSource: [ "Item 1", "Item 2", "Item 3" ], searchEnabled: true }); });
<div id="list"></div>
Angular
<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
<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
<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
@(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
Configuration
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 function that is executed when the widget's content is ready and each time the content is changed. |
onDisposing |
A function that is executed before the widget is disposed of. |
onGroupRendered |
A function that is executed when a group element is rendered. |
onInitialized |
A function that is executed only once, after the widget is initialized. |
onItemClick |
A function that is executed when a collection item is clicked or tapped. |
onItemContextMenu |
A function that is executed when a collection item is right-clicked or pressed. |
onItemDeleted |
A function that is executed after a list item is deleted from the data source. |
onItemDeleting |
A function that is executed before a collection item is deleted from the data source. |
onItemHold |
A function that is executed when a collection item has been held for a specified period. |
onItemRendered |
A function that is executed after a collection item is rendered. |
onItemReordered |
A function that is executed after a list item is moved to another position. |
onItemSwipe |
A function that is executed when a list item is swiped. |
onOptionChanged |
A function that is executed after a widget option is changed. |
onPageLoading |
A function that is executed before the next page is loaded. |
onPullRefresh |
A function that is executed when the "pull to refresh" gesture is performed. Supported in mobile themes only. |
onScroll |
A function that is executed on each scroll gesture. |
onSelectAllValueChanged |
A function that is executed when the "Select All" check box value is changed. Applies only if the selectionMode is "all". |
onSelectionChanged |
A function that is executed when a collection item is selected or the selection is canceled. |
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
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 without reloading data. Call it to update the widget's markup. |
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
Name | Description |
---|---|
contentReady |
Raised when the widget's content is ready. |
disposing |
Raised before the widget is disposed of. |
groupRendered |
Raised when a group element is rendered. |
initialized |
Raised only once, after the widget is initialized. |
itemClick |
Raised when a collection item is clicked or tapped. |
itemContextMenu |
Raised when a collection item is right-clicked or pressed. |
itemDeleted |
Raised after a list item is deleted from the data source. |
itemDeleting |
Raised before a collection item is deleted from the data source. |
itemHold |
Raised when a collection item has been held for a specified period. |
itemRendered |
Raised after a collection item is rendered. |
itemReordered |
Raised after a list item is moved to another position. |
itemSwipe |
Raised when a list item is swiped. |
optionChanged |
Raised after a widget option is changed. |
pageLoading |
Raised before the next page is loaded. |
pullRefresh |
Raised when the "pull to refresh" gesture is performed. |
scroll |
Raised on each scroll gesture. |
selectAllValueChanged |
Raised when the "Select All" check box value is changed. |
selectionChanged |
Raised when a collection item is selected or the selection is canceled. |
Default Item Template
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
If you have technical questions, please create a support ticket in the DevExpress Support Center.