List

Updated at:

Introduction

The list widget is a user interface element that displays a group of related items. It helps users quickly browse, select, or manage items.

Configuration items

Categorization

Configuration

Example

Description

Content

Data source

image

The data source for the list.

Primary key

The primary key is a field that uniquely identifies each data record. It ensures data integrity and accuracy.

Interaction

Hide

Controls the default display state of the list widget. If this parameter is set to true, the widget is hidden. For more information, see Common properties

Selectable

Specifies whether data items can be selected and display a selected state.

Default selection

This takes effect when **Selectable** is enabled. The value is the primary key of the data item.

Paging settings

The paging configuration for the list. If enabled, paging is supported.

Loading

The loading state of the list.

Style

Height

For more information, see Common properties

Margin

For more information, see Common properties

Padding

For more information, see Common properties

List format

The display format of the list.

Line separator

image

This takes effect in list mode. It specifies whether to use a line separator between data items.

Columns

This takes effect when **List format** is set to Grid. It specifies the number of data items to display in a row.

Grid size

This takes effect when **List format** is set to Grid. It specifies the spacing between data items.

Empty state text

The text to display when the list data source is empty.

CSS style

Overflow

Sets the behavior for data that overflows the list. This corresponds to the CSS overflow property. For more information, see the MDN documentation

Background color

Sets the background color. This corresponds to the CSS background-color property. For more information, see the MDN documentation

Background

image

Sets various background properties, such as color, image, origin, size, and repeat. This corresponds to the CSS background property. For more information, see the MDN documentation

Background image

image

Sets one or more background images. This corresponds to the CSS background-image property. For more information, see the MDN documentation

Shadow

image

Sets a shadow effect. This corresponds to the CSS box-shadow property. For more information, see the MDN documentation

Top border

Sets the top border properties. This corresponds to the CSS border-top property. For more information, see the MDN documentation

Bottom border

Sets the bottom border properties. This corresponds to the CSS border-bottom property. For more information, see the MDN documentation

Left border

Sets the left border properties. This corresponds to the CSS border-left property. For more information, see the MDN documentation

Right border

Sets the right border properties. This corresponds to the CSS border-right property. For more information, see the MDN documentation

Border radius

The border radius of the list widget. This corresponds to the CSS border-radius property. For more information, see the MDN documentation

Border

The border of the list widget. This corresponds to the CSS border property. For more information, see the MDN documentation

Selected state background color

This takes effect when **Selectable** is set to true. It specifies the background color of a selected list item.

Selected state hover background color

image

This takes effect when **Selectable** is set to true. It specifies the background color when the mouse hovers over a selected list item.

Properties and methods

Name

Type

Example

Description

dataSource

array

list1.dataSource

The data source of the current list widget.

loading

boolean

list1.loading

The loading state of the current list widget.

selectedKey

string

list1.selectedKey

The primary key value of the currently selected data item.

pagination

object

list1.pagination

Read-only. The paging information of the current list widget.

setDataSource

func

list1.setDataSource(xxxx)

Sets the data for the list widget to xxxx.

clearDataSource

func

list1.clearDataSource()

Clears the data from the list widget.

setLoading

func

list1.setLoading(true)

Sets the loading state of the list widget. The parameter value can be true or false.

clearLoading

func

list1.clearLoading()

Clears the loading state of the list widget.

setSelectedKey

func

list1.setSelectedKey('option1')

Sets the primary key of the selected data item in the list widget to option1.

clearSelectedKey

func

list1.clearSelectedKey()

Clears the primary key of the selected data item in the list widget.

Event callbacks

Configuration

Description

The event that is triggered when a list item is clicked.