Render table in react, fully customizable, compatible with redux
npm install react-custom-tableRender table in react, fully customizable, compatible with redux.
Live Demo: https://da-kuang.github.io/react-custom-table/
Run demo locally:
```
git clone https://github.com/Da-Kuang/react-custom-table.git
npm run demo
http://localhost:8080
``
npm install react-custom-table --save
`
import React from 'react';
import { TableContainer, Table } from 'react-custom-table';
{id: "name", title: "Name"},
{id: "gender", title: "Gender"}
]}
rows={[
{id: "1", name: "David", gender: "Male"},
{id: "2", name: "Kelly", gender: "Female"},
{id: "3", name: "James", gender: "Male"},
{id: "4", name: "Tim", gender: "Male"}
]} >
`
`
import React from 'react';
import { TableContainer, Table, Paginator } from 'react-custom-table';
{id: "name", title: "Name"},
{id: "gender", title: "Gender"}
]}
rows={[
{id: "1", name: "David", gender: "Male"},
{id: "2", name: "Kelly", gender: "Female"},
{id: "3", name: "James", gender: "Male"},
{id: "4", name: "Tim", gender: "Male"}
]}>
`
`
import React from 'react';
import { TableContainer, Table, Paginator } from 'react-custom-table';
const columns = [
{id: "name", title: "Name", sortable: true},
{id: "gender", title: "Gender", template: (v) => {v.gender}},
{id: "age", title: "Age", sortable: true},
{id: "height", title: "Height", sortable: false}
]
const pageData = {
{id: "1", name: "David", gender: "Male", age: "17", height: "176"},
{id: "2", name: "Kelly", gender: "Female", age: "19", height: "180"},
{id: "3", name: "James", gender: "Male", age: "12", height: "150"},
{id: "4", name: "Tim", gender: "Male", age: "39", height: "180"}
}
columns={columns}
rows={pageData}
onSort={this.handleSort}
onPageChange={this.handlePageClick}>
total={7}
firstPageTemplate={() => {"<<"}}
prevPageTemplate={() => {"<"}}
pageTemplate={(p) => {p}}
nextPageTemplate={() => {">"}}
lastPageTemplate={() => {">>"}}
pageSize={4}/>
``
To see more details for the usage, please check the code in our demo folder.