Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rsuite-table

Package Overview
Dependencies
Maintainers
1
Versions
223
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsuite-table

A React table component

  • 3.3.0-beta
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33K
decreased by-25.75%
Maintainers
1
Weekly downloads
 
Created
Source

rsuite-table

A React table component,

npm

Travis Coverage Status

Features

  • Support fixed header, fixed column.
  • Support custom adjustment column width.
  • Support for custom cell content.
  • Support for displaying a tree form.
  • Support for sorting.

Install

npm i rsuite-table --save

Usage

import { Table, Column, HeaderCell, Cell } from 'rsuite-table';
import 'rsuite-table/lib/less/index.less'

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" />
  </Column>

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

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

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

API

<Table>

PropertyType (Default)Description
autoHeightbooleanAutomatic height
borderedbooleanShow border
cellBorderedbooleanShow cell border
data *Array<Object>Table data
defaultExpandAllRowsbooleanExpand all nodes By default
defaultExpandedRowKeysArray<string>Specify the default expanded row by rowkey
defaultSortTypeenum: 'desc', 'asc'Sort type
expandedRowKeysArray<string>Specify the default expanded row by rowkey (Controlled)
headerHeightnumber(40)Table Header Height
heightnumber(200)Table height
isTreebooleanShow as Tree table
loadingbooleanShow loading
minHeightnumber (0)Minimum height
onExpandChange(expanded:boolean,rowData:object)=>voidTree table, the callback function in the expanded node
onRowClick(rowData:object)=>voidClick the callback function after the row and return to rowDate
onScroll(scrollX:object, scrollY:object)=>voidCallback function for scroll bar scrolling
onSortColumn(dataKey:string, sortType:string)=>voidClick the callback function of the sort sequence to return the value sortColumn, sortType
renderRowExpanded(rowDate?: Object) => React.NodeCustomize what you can do to expand a zone
renderTreeToggle(icon:node,rowData:object)=> nodeTree table, the callback function in the expanded node
rowClassNamestring , (rowData:object)=>stringAdd an optional extra class name to row
rowExpandedHeightnumber (100)Set the height of an expandable area
rowHeightnumber(46)Row height
rowKeystring ('key')Each row corresponds to the unique key in data
setRowHeight(rowData:object)=> numberCustom Settings Row Height
showHeaderboolean (true)Display header
sortColumnstringSort column name ˝
sortTypeenum: 'desc', 'asc'Sort type (Controlled)
widthnumberTable width

<Column>

PropertyType (Default)Description
alignenum: 'left','center','right'Alignment
colSpannumberMerges column cells to merge when the dataKey value for the merged column is null or undefined.
fixedbooleanFixed column
flexGrownumberSet the column width automatically adjusts, when set flexGrow cannot set resizable and width property
minWidthnumber(200)When you use flexGrow, you can set a minimum width by minwidth
onResize(columnWidth?: number, dataKey?: string) => voidCallback after column width change
resizablebooleanCustomizable Resize Column width
sortablebooleanSortable
widthnumberColumn width

sortable is used to define whether the column is sortable, but depending on what key sort needs to set a dataKey in Cell. The sort here is the service-side sort, so you need to handle the logic in the ' Onsortcolumn ' callback function of <Table>, and the callback function returns sortColumn, sortType values.

<Cell>

PropertyType (Default)Description
dataKeystringData binding key, but also a sort of key
rowDataobjectRow data
rowIndexnumberRow number

FAQs

Package last updated on 27 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc