Компонент <List>
Компонент <List>
нужен для отображения списка полученых данных.
Для получения данных компонент <List>
вызывает getList
метод из <dataProvider>
для текущего ресурса
Props
Props | Тип |
---|---|
columns (required) | array<object> |
title (optional) | string |
actions (optional) | React Component |
filters (optional) | React Component |
perPage (optional) | number |
view (optional) | 'edit', 'show' |
viewOptions (optional) | object |
ColumnType
Props | Тип |
---|---|
id (optional) | string |
title (required) | string |
source (required) | string |
Field (required) | React Component |
FieldChildren (optional) | React Component |
reference (optional) | string |
link (optional) | string |
sortDirections (optional) | 'descend', 'ascend' |
sorter (optional) | (a, b) => number; |
Пример использования
const columns: ColumnT[] = [{title: 'ID',source: '_id',Field: TextField,sortDirections: ['descend', 'ascend'],},{title: 'Author',source: 'author',Field: TextField,},{title: 'Title',source: 'title',Field: TextField,sortDirections: ['descend', 'ascend'],},{title: 'Body',source: 'body',Field: TextField,sortDirections: ['descend', 'ascend'],},{title: 'Created At',source: 'createdAt',Field: DateField,sortDirections: ['descend', 'ascend'],},];<List view="edit" columns={columns} />;