| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import React from 'react';
- import { Table, Tag, Tooltip } from '@douyinfe/semi-ui';
- export default class FixedTableApp extends React.Component {
- constructor(props = {}) {
- super(props);
- this.columns = [
- {
- title: 'Name',
- dataIndex: 'name',
- width: 150,
- fixed: true,
- filterMultiple: false,
- filters: [
- {
- // text: <span style={{ display: 'inline-flex', width: '100%', height: '100%' }}></span>,
- text: '',
- value: '',
- },
- {
- text: 'Code 45',
- value: '45',
- },
- {
- text: 'King 4',
- value: 'King 4',
- },
- ],
- onFilter: (value, record) => record.name.includes(value),
- },
- {
- title: 'Age',
- dataIndex: 'age',
- fixed: true,
- width: 150,
- sorter: (a, b) => (a.age - b.age > 0 ? 1 : -1),
- },
- {
- title: 'Address',
- // width: 200,
- dataIndex: 'address',
- },
- {
- title: 'Description',
- width: 400,
- dataIndex: 'description',
- fixed: 'right',
- },
- {
- fixed: 'right',
- width: 250,
- render: (text, record) => (
- <Tooltip content={record.description}>
- <Tag color="green">Show Info</Tag>
- </Tooltip>
- ),
- },
- ];
- this.data = [];
- this.rowSelection = {
- onChange: (selectedRowKeys, selectedRows) => {
- // console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
- },
- getCheckboxProps: record => ({
- disabled: record.name === 'Disabled User', // Column configuration not to be checked
- name: record.name,
- }),
- };
- for (let i = 0; i < 46; i++) {
- let age = (i * 1000) % 149 ;
- let name = `Edward King ${i}`;
- this.data.push({
- key: `${ i}`,
- name,
- age,
- address: `London, Park Lane no. ${i}`,
- description: `My name is ${name}, I am ${age} years old, living in New York No. ${i + 1} Lake Park.`,
- });
- }
- this.scroll = { y: 300, x: 2000 };
- }
- render() {
- // eslint-disable-next-line max-len
- return <Table style={{ width: 2000 }} resizable bordered columns={this.columns} dataSource={this.data} scroll={this.scroll} />;
- }
- }
|