# @pubcore/pubcore-react-datatable

> stateless react components for HTML tables

Latest version **1.0.2** (published 2017-10-29) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @pubcore/pubcore-react-datatable
pnpm add @pubcore/pubcore-react-datatable
yarn add @pubcore/pubcore-react-datatable
bun add @pubcore/pubcore-react-datatable
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-10-29 |
| First published | 2017-10-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | jacklrs |

## Links

- npm: https://www.npmjs.com/package/@pubcore/pubcore-react-datatable
- Repository: https://github.com/pubcore/reactDatatable
- Homepage: https://github.com/pubcore/reactDatatable#readme
- Issues: https://github.com/pubcore/reactDatatable/issues
- npm.io page: https://npm.io/package/@pubcore/pubcore-react-datatable

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^16.0.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.0.0
- [prop-types](https://npm.io/package/prop-types.md) ~15.6.0
- [pubcore-ui-text](https://npm.io/package/pubcore-ui-text.md) ~1.0.7

## Recent versions

- 1.0.2 (latest) — 2017-10-29

## README

## Stateless react components to render HTML tables

### Installation

	npm install --save pubcore-react-datatable

### Examples

	import Datatable from 'pubcore-react-datatable'

	const rows = [
		{a:'11', b:'12'},
		{a:'21', b:'22'}
	],
		cols = ['a', 'b']

	//table without head row
	<Datatable {...{rows}}/>

	//table with head row, columns order based on "cols"
	<Datatable {...{rows, cols}}/>

## customize table view

	//some more components to import
	import Datatable, {Head, HeadRow, Cell, Body, Row} from 'pubcore-react-datatable'

	//table with individual header row(s)
	<Datatable {...{rows, cols}}>
	    <Head>
	        <HeadRow>{({col}) =>
	            <Cell key={col}>
	                {col} <button onClick={e => alert('info')} type="button">i</button>
	            </Cell>
	        }</HeadRow>
	        <HeadRow {...{cols:cols.map((col, i) => i)}}/>
	    </Head>
	</Datatable>

	//change view of column's data
	<Datatable {...{rows, cols}} >
	    <Body>
	        <Row>{({col, row}) => ({'b' :
	            <Cell data={(new Date(row[col])).toLocaleDateString()} key={col}/>
	            }[col] ||
	            <Cell key={col} data={row[col]}/>
	        )}</Row>
	    </Body>
	</Datatable>

---
_Source: https://npm.io/package/@pubcore/pubcore-react-datatable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
