ListView Component
The React ListView component renders a data-driven list with support for templates, grouping, sorting, and virtualization.
- Accepts array or DataManager datasource with customizable field mappings and provides header/footer/item/group templates and events (data load, data request, scroll).
- Optimized for large data via virtualization and exposes props for sorting, disabling, and query-based fetching.
Usage
To import and use the ListView component in your application, use the following code snippet:
Demos
Explore the demos of the React ListView component. Refer to this page.
Props
The following table outlines the props for the ListView component:
| Name | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | false | Specifies whether user interactions with the ListView (e.g., clicks, key presses) are disabled.
When |
| fields | FieldsMapping | { id: 'id', text: 'text', url: 'url', disabled: 'disabled', icon: 'icon', visible: 'visible', tooltip: 'tooltip', htmlAttributes: 'htmlAttributes', imageUrl: 'imageUrl', groupBy: undefined } | Maps properties from each record in |
| footerTemplate | node | - | Specifies content to be rendered at the bottom of the list, serving as a footer. |
| groupTemplate | Function | node | - | Specifies a custom template for rendering group header sections when items are categorized into groups. |
| headerTemplate | node | - | Specifies content to be rendered at the top of the list, serving as a header. |
| itemTemplate | Function | node | - | Specifies a custom template for rendering each item in the ListView, allowing for customized appearance of list items. |
| query | - | The | |
| sortOrder | SortOrder.None | Specifies the sort order for items and for group headers when | |
| virtualization | VirtualizationProps | - | Specifies virtualization settings to enable windowed rendering for improved performance with large lists. |
Events
The following table outlines the events for the ListView component:
| Name | Type | Description |
|---|---|---|
| onDataLoad | (event: DataLoadEvent) => void | Specifies an event that triggers after data is fetched successfully. |
| onDataRequest | (event: DataRequestEvent) => void | Specifies an event that triggers before data is fetched. |
| onScroll | (event: ScrollEvent) => void | Specifies a scroll event handler to be attached to the scrollable container. This is particularly useful when virtualization is enabled. |