1.1.1 • Published 1 year ago

@anchor-it/antd-table v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

@anchor-it/antd-table

anchor components library table by ant.design

Install

Use npm:

npm install --save @anchor-it/antd-table

Use yarn:

yarn add @anchor-it/antd-table -S

Usage

import React, { Component } from 'react';
import { TableComponent, tableSelectionMode } from '@anchor-it/antd-table';

const { multiple } = tableSelectionMode;

class TestTable extends Component {
  static propTypes = {};

  state = {
    data: [],
    loading: false,
    pageNum: 1,
    pageSize: 12,
    selectedKeys: [],
    selectedRowsData: [],

    cols: [
      {
        key: 0,
        title: 'id',
        dataIndex: 'id',
      },
      {
        key: 1,
        title: '姓名',
        dataIndex: 'name',
      },
      {
        key: 2,
        title: '性别',
        dataIndex: 'sex',
      },
      {
        key: 3,
        title: '手机号码',
        dataIndex: 'phone',
      },
    ],
  };

  handlePaginationOnChange = () => {};

  handleOnSort = () => {};

  render() {
    return (
      <TableComponent
        ref={(node) => (this.table = node)}
        loading={this.state.loading}
        dataSource={this.state.data}
        primaryKey={'id'}
        isShowPagination={true}
        selectedRowKeys={this.state.selectedKeys}
        selectedRowData={this.state.selectedRowsData}
        tablePagesize={this.state.pageSize}
        tableTotalRecord={this.state.total}
        tableSelectionMode={multiple}
        tableOnChange={this.handleTableOnChange}
        paginationOnChange={this.handlePaginationOnChange}
        currentPage={this.state.pageNum}
        onSort={this.handleOnSort}
        cols={this.state.cols}
      />
    );
  }
}

export default TestTable;

Api

属性说明类型默认值
loading页面是否加载中booleanfalse
dataSource数据数组object[]-
size表格大小default| middle| smalldefault
primaryKey表格行 key 的取值,可以是字符串或一个函数stringkey
hasBorder是否展示外边框和列边框booleantrue
hasHeader是否显示表头booleantrue
scroll表格是否可滚动,也可以指定滚动区域的宽、高Object-
isShowPagination是否显示分页组件booleantrue
isShowTotalRecord是否显示总记录数目booleanfalse
selectedRowKeys指定选中项的 key 数组string[] | number[][]
tablePagesize每页条数number-
tableTotalRecord数据总数number0
tableSelectionMode列表选择类型none|checkbox|radionone
tableDefaultSelectRowKeys默认选中项的 key 数组string[] | number[][]
tableOnChange列表选中时的触发事件function(selectedRowKeys, selectedRows)-
tableOnRowClick列表的行点击事件function(index, record, event)-
paginationOnChange列表的翻页事件function(page)-
paginationShowQuickJumper列表翻页组件是否显示快捷跳转booleanfalse
cols列表的列配置object[]-
currentPage列表的当前页number-
onSort列表的排序事件function(field,order)-
isZebra是否显示斑马纹booleanfalse
1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.12

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago