Skip to main content

Table table component

Effect demonstration​

1. Basic usage​

 const columns = [
{
title: 'Role',
dataIndex: 'roleName',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 100,
},
{
title: 'Business module',
dataIndex: 'businessModule',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 100,
},
{
title: 'IP address',
dataIndex: 'loginIp',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 200,
},
];
const dataSource = [
{
id: 4694447,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'SuperAdmin',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '',
opType: 'Unban member account, manga',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member Module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:17:22.000+08:00',
},
{
id: 4694446,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'SuperAdmin',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '117569,[2, 1, 4],11',
opType: 'Ban member account, manga',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member Module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:17:09.000+08:00',
},
{
id: 4694443,
userId: 116969,
userName: 'zhuxc',
nickName: 'zhuxc',
roleId: 519,
roleName: 'SuperAdmin',
opDepartmentId: 4,
opDepartmentName: 'Root Department 1',
accountType: 1,
opResources: 'zhuxc',
opType: 'Operator username and password login',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'User login',
loginIp: '60.12.241.84',
loginCity: null,
createdAt: '2020-12-01T17:15:09.000+08:00',
},
{
id: 4694369,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'SuperAdmin',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '117569,[4],11',
opType: 'Ban member account, manga',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member Module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:00:21.000+08:00',
},
{
id: 4694357,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'SuperAdmin',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '',
opType: 'View black and white list',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Black and white list',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T16:59:43.000+08:00',
},
];
<WingBlank>
<Table columns={columns} dataSource={dataSource} height={300} />
</WingBlank>

2. Columns attribute​

  const columns = [
{
title: 'Administrator',
dataIndex: 'userInfo',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 100,
flex: 2,
},
{
title: 'role',
dataIndex: 'roleName',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 50,
},
{
title: 'Department',
dataIndex: 'opDepartmentName',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 20,
},
{
title: 'Operation content',
dataIndex: 'opContent',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
},
{
title: 'Business module',
dataIndex: 'businessModule',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
},
{
title: 'Operation time',
dataIndex: 'createdAt',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'dateTimeRange',
},
{
title: 'IP address',
dataIndex: 'loginIp',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
},
];

const dataSource = [
{
id: 4694447,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '',
opType: 'Unban member account, manga',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member Module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:17:22.000+08:00',
},
{
id: 4694446,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '117569,[2, 1, 4],11',
opType: 'Ban member account, manga',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member Module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:17:09.000+08:00',
},
{
id: 4694443,
userId: 116969,
userName: 'zhuxc',
nickName: 'zhuxc',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 4,
opDepartmentName: 'Root Department 1',
accountType: 1,
opResources: 'zhuxc',
opType: 'Operator username and password login',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'User login',
loginIp: '60.12.241.84',
loginCity: null,
createdAt: '2020-12-01T17:15:09.000+08:00',
},
{
id: 4694369,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '117569,[4],11',
opType: 'Ban member account, manga',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member Module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:00:21.000+08:00',
},
{
id: 4694357,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '',
opType: 'View black and white list',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Black and white list',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T16:59:43.000+08:00',
}]
<WingBlank>
<Table columns={columns} dataSource={data} height={300} />
</WingBlank>

3. Horizontal scrolling​

   const columns = [
{
title: 'Administrator',
dataIndex: 'userInfo',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 120,
flex: 2,
},
{
title: 'Kakuiro',
dataIndex: 'roleName',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 120,
},
{
title: 'Department',
dataIndex: 'opDepartmentName',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 120,
},
{
title: 'Operation details',
dataIndex: 'opContent',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
},
{
title: 'Business module',
dataIndex: 'businessModule',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
},
{
title: 'Operation time',
dataIndex: 'createdAt',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'dateTimeRange',
width: 300,
},
{
title: 'IP address',
dataIndex: 'loginIp',
align: 'left',
ellipsis: false,
copyable: false,
valueType: 'text',
hideInSearch: false,
width: 180,
},
];

const dataSource = [
{
id: 4694447,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '',
opType: 'Unban member account, manga',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member Module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:17:22.000+08:00',
},
{
id: 4694446,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 22,
opDepartmentName: 'lw is',
accountType: 1,
opResources: '117569,[2, 1, 4],11',
opType: 'Ban member account, manga',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member Module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:17:09.000+08:00',
},
{
id: 4694443,
userId: 116969,
userName: 'zhuxc',
nickName: 'zhuxc',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 4,
opDepartmentName: 'Root Department 1',
accountType: 1,
opResources: 'zhuxc',
opType: 'Operator username and password login',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'User login',
loginIp: '60.12.241.84',
loginCity: null,
createdAt: '2020-12-01T17:15:09.000+08:00',
},
{
id: 4694369,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 22,
opDepartmentName: 'Lw is',
accountType: 1,
opResources: '117569,[4],11',
opType: 'Banning member accounts and comics',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Member module',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T17:00:21.000+08:00',
},
{
id: 4694357,
userId: 117676,
userName: 'sxj',
nickName: 'sxj',
roleId: 519,
roleName: 'Super administrator role',
opDepartmentId: 22,
opDepartmentName: 'Lw is',
accountType: 1,
opResources: '',
opType: 'View list of black and white lists',
deviceNo: null,
deviceSystem: null,
clientId: 'manke-management',
groupId: null,
businessModule: 'Black and white list',
loginIp: '222.173.46.190',
loginCity: null,
createdAt: '2020-12-01T16:59:43.000+08:00',
},
];
<WingBlank>
<Table columns={columns} dataSource={data} height={300} />
</WingBlank>

4. Empty state​

const columns = [
{
title: "Administrator",
dataIndex: "userInfo",
align: "left",
ellipsis: false,
copyable: false,
valueType: "text",
hideInSearch: false,
width: 100,
flex: 2,
},
{
title: "Role",
dataIndex: "roleName",
align: "left",
ellipsis: false,
copyable: false,
valueType: "text",
hideInSearch: false,
width: 50,
},
{
title: "Department",
dataIndex: "opDepartmentName",
align: "left",
ellipsis: false,
copyable: false,
valueType: "text",
hideInSearch: false,
width: 20,
},
{
title: "Operation content",
dataIndex: "opContent",
align: "left",
ellipsis: false,
copyable: false,
valueType: "text",
hideInSearch: false,
},
{
title: "Business module",
dataIndex: "businessModule",
align: "left",
ellipsis: false,
copyable: false,
valueType: "text",
hideInSearch: false,
},
{
title: "Operating time",
dataIndex: "createdAt",
align: "left",
ellipsis: false,
copyable: false,
valueType: "dateTimeRange",
},
{
title: "IP address",
dataIndex: "loginIp",
align: "left",
ellipsis: false,
copyable: false,
valueType: "text",
hideInSearch: false,
},
];

<WingBlank>
<Table columns={columns} dataSource={[]} height={300} />
</WingBlank>;

API​

Table component API​

PropertiesRequiredDescriptionTypeDefault Value
columnstrueTable column definitionsColumnProps[]
dataSourcetruetable data[{ [key: string]: string }]
keyExtractortrueSpecifies the unique identification field of Table(item: T, index: number) => string
headerStylefalseForm header styleViewStyle
rowStylefalseData row styleViewStyle
onRefreshfalseTable drop-down refresh() => void
onEndReachedfalseTable pull-up loading() => void
refreshingfalserefresh statusbooleanfalse
heightfalseThe height of the form (flex:1 if left blank, determined by the outer container)numberdeviceHeight
fixedHeaderfalseWhether to fix the headbooleanfalse
showHeaderfalseWhether to display the headerbooleanfalse
emptyComponentfalseEmpty state viewReactElement

ColumnProps Properties​

PropertiesRequiredDescriptionTypeDefault Value
titletrueThe column title of the formstring
dataIndextruekey value of datastring
numberOfLinesfalseNumber of lines of textnumber
ellipsisModefalseInterception method after exceedinghead | middle | tail | clip
textAlignfalseText alignmentcenter | left | right
widthfalseColumn widthnumber
renderTextfalseCustom text(item: any, column: ColumnProps) => string
renderfalseCustom component(item: any, column: ColumnProps) => ReactElement