8000 GitHub - holly-juan/rsuite-table: A React table component.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

holly-juan/rsuite-table

 
 

Repository files navigation

rsuite-table

rsuite-table 是一个 React 实现的 <Table> 组件,主要特性有:

  • 支持固定表头,固定列(固定在左侧);
  • 支持自定义调整列宽;
  • 支持自定义单元格内容;
  • 支持显示树状表格;
  • 支持排序。

版本与状态

npm

npm

Travis Coverage Status

快速开始

安装

npm i rsuite-table --save

rsuite-table 中的组件依赖了 rsuite,所以需要安装一下 rsuite

npm i rsuite --save

样式

less 文件中引入:

@import '~rsuite-table/lib/less/index.less';

示例代码

import { Table, Column, HeaderCell, Cell } from 'rsuite-table';

const dataList = [
    {id:1, name:'a', email:'a@email.com',avartar:'...'},
    {id:2, name:'b', email:'b@email.com',avartar:'...'},
    {id:3, name:'c', email:'c@email.com',avartar:'...'}
];

const ImageCell = ({ rowData, dataKey, ...props }) => (
    <Cell {...props}>
        <img src={rowData[dataKey]} width="50" />
    </Cell>
);


<Table data = {dataList}  >
    <Column  width = {100} sort fixed resizable>
        <HeaderCell>ID</HeaderCell>
        <Cell dataKey="id"></Cell>
    </Column>

    <Column  width = {100} sort resizable>
        <HeaderCell>Name</HeaderCell>
        <Cell dataKey="name"></Cell>
    </Column>

    <Column  width = {100} sort resizable>
        <HeaderCell>Email</HeaderCell>
        <Cell dataKey="email"></Cell>
    </Column>

    <Column  width = {100} resizable>
        <HeaderCell>Avartar</HeaderCell>
        <ImageCell dataKey="avartar"></ImageCell>
    </Column>
</Table>

About

A React table component.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 92.0%
  • CSS 7.9%
  • Shell 0.1%
0