0.1.5 • Published 4 years ago

antd-table-virtualized v0.1.5

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

NPM registryNPM license

antd-table-virtualized

React table components compatible with some antd table API

:warning: This version is not stable yet, please do not use it in production environment

Install

# Yarn
yarn add antd-table-virtualized

# NPM
npm install --save antd-table-virtualized

Usage

import AntdTableVirtualized from 'antd-table-virtualized'

// Note: in order to autosize the table, you need to set the
//       wrapper element's style property `display` to `flex`.
//       Otherwise the view will be blank.

<div style={{ dispaly: 'flex' }}>
  <AntdTableVirtualized
    {/* props here */}
  />
  <div>
    {/* other code here */}
  </div>
</div>

Please refer to src/App.js for usage, feel free to contact me lingirlsea@gmail.com :heart:

API

AntdTableVirtualized

PropertyDescriptionTypeDefaultVersion
borderedWhether to show all table bordersbooleanfalse
stripedWhether Table is stripedbooleanfalse
clickHighlightWeather highlight the row after you clicked, support for custom color valuesboolean | stringfalse
rowHeightHeight for content rownumber40
rowHeadHeightHeight for head rownumber40
multipleSortMulti-header sort, used with column sortbooleanfalse
placeholderTo customize innerHTML when no dataReactNodeNo Data
classNameTable's classNamestring-
columnsColumns of tablearray-
dataSourceData record array to be displayedarray-
paginationConfig of pagination. You can ref table pagination config or full pagination document, hide it by setting it to falseobject-
rowSelectionRow selection configobjectnull
onRowSet props on per row, documentFunction(record, index)-

pagination also support properties below

PropertyDescriptionTypeDefaultVersion
heightPagination heightnumber50
wrapperStyleWrapper element style for paginationobject-

rowSelection

Properties for row selection.

PropertyDescriptionTypeDefaultVersion
columnWidthSet the width of the selection columnnumber48
getCheckboxPropsGet Checkbox propsFunction(record)-
selectedRowKeysControlled selected row keysnumber[][]
onChangeCallback executed when selected rows changeFunction(selectedRowKeys, selectedRows)
onSelectCallback executed when select/deselect one rowFunction(selectedRowKeys, selectedRows)-
onSelectAllCallback executed when select/deselect all rowsFunction(selected, selectedRows, changeRows)-

Column

One of the Table columns prop for describing the table's columns, Column has the same API.

PropertyDescriptionTypeDefaultVersion
ellipsisEllipsize cell contentbooleanfalse
toolTipA simple text popup tip, Used with ellipsis, documentboolean|objectfalse
widthWidth of this columnnumber-
fixedSet column to be fixed: true(same as left) 'left' 'right'booleanstring-
sortColumn sort, see example belowobject-
renderRenderer of the table cell. The return value should be a ReactNodeFunction(text, record, index) {}-
sort: {
  // 'ascend' | 'descend'
  defaultOrder: 'ascend',
  handle: (sortFields) => {
    console.log(sortFields)
  }
}

Related libraries

  • antd: An enterprise-class UI design language and React UI library.
  • react-window: React components for efficiently rendering large lists and tabular data.
  • react-virtualized-auto-sizer: HOC that grows to fit all of the available space and passes the width and height values to its child.

License

MIT