The component List View is for you to display rows of data. It works like a container: you can insert other components into it and bind data to these components.
The component List View displays rows of data. Similar to Form, Modal, and Drawer, it is also a container-like component that can hold other components or modules. For list viewing data, you first bind the data to a List View component and configure the naming rules for the items. Then, you design the display of the first row by dragging and dropping components, and this layout will be applied to all items within this component.
Drag and drop List View onto the canvas. Each item contains an Image, a Text and a Rating component. You can update the exhibition of the whole List View component by configuring the layout of the first entry.
Click the Image component, you see the defaulted image source.
The List View component retrieves data from a JSON array of objects and displays an Image, a Text and a Rating component for each entry. You can also pass query results to a List View.
The data of a List View component accepts two types of values: number and array.
- Number: Numbers are processed as row count and no valid data is passed into the List View component.
- Array: The length of an array is passed as row count and each entry in the array is processed as a JS object in JSON format, corresponding to a row in the List View component. For example, the following data contains two rows of data, each containing four fields:
"title": "The Shawshank Redemption",
"title": "The Godfather",
You can view the detailed data about the List View component, its items, the properties, etc., in the data browser.
After binding valid data to List View component and designing its inside components, you can add data to these components. List View supports local variables
i. Notice that you only need to change data of the first row, and the same settings are applied to the other rows automatically.
You can bind a static URL address to the Image component for image display; and because that URL address is static, the same image shows up in all rows.
You can set the item index names and item data names. This is useful when embedding a list in another list. For example, you can set the index of one list as
i, and the inner nested
jto avoid naming conflict.
By default, item index is named as
i, referring to the index of list data and starting from zero. Besides using
ias numbers, you can also use
ito dynamically access data from query results.
For example, to access the
book_namefield from table
fictionin the Text component, write the following code.
Then you can see the fiction book names displayed in List View by index order.
By default, you can reference the value of each item within a list using variable
currentItem. For example, to display a serial number plus book name, write the following code in
Circular dependency errors occur when you reference the data of a row by
listView.items[i]from a component inside a List View component. It is recommended to use such reference only outside the list.
Toggle "Show quick jumper" or set its value to
trueto allow your users quickly jump to the specified page.
You can configure whether to allow your users to customize how many items to be displayed on a single page by enabling or disabling the "Show size changer button" or set its value in JS. When disabled, you can set the default page size.
If enabled, you can configure several page sizes for your users to select.
By default, the total row count of a List View component is the number of current data items. You can also insert a value from a query. For example,
List View supports exposing data of inside components with Items field. You can inspect the Data Browser in the left pane.
For example, drag an Input component into List View, and then you can reference the value of the Rating component in components outside the List View by the following code.