BTable
Just describe table fields. Use subclasses of TableField.
Example
import React from 'react';
import BTable from '@ui/BTable';
import ITableField from '@ui/BTable/BtableBase/models/ITableField';
const MyComponent: React.FC = () = {
const actions = [
{
type: BTableActionType.EDIT,
method: (e: any) => handleModal(e, EntityChangeFormType.UPDATE),
},
{
type: BTableActionType.DELETE,
method: (e: any) => handleModal(e, EntityChangeFormType.DELETE),
}
];
const listOptions = {
pagination: {
enabled: true,
},
sort: {
enabled: false,
},
};
const tableFields: ITableField[] = [
{
name: 'title',
keyName: 'title',
label: 'Заголовок',
},
{
name: 'id пользователя',
keyName: 'userId',
label: 'id пользователя',
},
];
const footFields = [];
return (
<>
<BTable
fields={tableFields}
getData={(data: any) => API.getData(data)}
actions={actions}
listOptions={listOptions}
footFields={footFields}
limit={20}
rowClick={rowClick}
style={style}
nodeStyle={nodeStyle}
/>
</>
);
};
export default MyComponent;BTable props
IBTableProps<T>
Property
Description
Type
Default
getData
data get method
```(...args: any[]) => Promise<AxiosResponse<T[]
IErrorResponse>
limit
number of rows in the table
number
10
rowClick
click on row
```(item?: number
string) => void```
style
container styles
React.CSSProperties
undefined
nodeStyle
node styles
React.CSSProperties
undefined
ITableField
ITableFieldITableFooterField
ITableFooterFieldIAction
IActionITableOptions
ITableOptionsLast updated