1.3.4 • Published 3 years ago

@pubcore/react-datatable v1.3.4

Weekly downloads
30
License
MIT
Repository
github
Last release
3 years ago

Build Status

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, isHead, key}) =>
            <Cell {...{key, isHead}} >
                {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, index, key}) => ({'b' :
            <Cell {...{data:(new Date(row[col])).toLocaleDateString(), key}}/>
            }[col] ||
            <Cell {...{data:`# ${index}`, key}}/>
        )}</Row>
    </Body>
</Datatable>
1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.7

4 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago