react-grid
React UI Component - Grid(Based on Ant Design)
Use
$ npm install rc-grid --save
More detail - See here
// based on Ant design, so you should import this style// the default grid style// after above, you can import your style if need// import 'your-style.less'Component { superprops const time = // dataSource for single page // in real time, we always fetch data through a http request. when the page change, we get the next page's data const dataSource = name: 'test' id: '1' created_at: time name: 'test' id: '2' created_at: time + 1000 name: 'test' id: '3' created_at: time + 2000 name: 'test' id: '4' created_at: time + 3000 name: 'test' id: '5' created_at: time + 4000 name: 'test' id: '6' created_at: time + 5000 name: 'test' id: '7' created_at: time + 5000 thisstate = dataSource } { const dataSource = thisstate const columns = name: 'name' label: 'Name' { return name } span: 5 name: 'created_at' // the key in the dataSource label: 'Created At' // table head label sortable: 'asc' // the way to sort, sortType: asc and desc { dataSource this } { return created_at } span: 5 // you can specific a span width to one column, from 1 to 24, default is flexible const itemHeader = name: 'id' { return `Id: ` } const itemActions = name: 'Detail' { console } name: 'Edit' { console } name: 'Delete' { console } const gridActions = name: 'Refresh' { console } const bacthActions = name: 'Delete' { console } // warning: the pagination depend on the total and size, not depend on the dataSource's length const pagination = total: 100 // total count size: 2 // page size currentPage: 1 // current page { // page change callback console } // checkable[boolean]: render checkbox for each item const checkable = true // International const locale = action: 'Action' no_data: 'No Data' first_page: 'First Page' items_per_page: '/page' jump_to: 'Jump To' last_page: 'Last Page' next_5: 'Next 5 pages' next_page: 'Next Page' prev_5: 'Previous 5 pages' prev_page: 'Previous Page' asc: 'Ascending' desc: 'Descending' return <div style=padding: '10px 8px'> <Grid className='xxx-grid' dataSource=dataSource columns=columns itemActions=itemActions gridActions=gridActions pagination=pagination batchActions=bacthActions locale=locale checkable=checkable itemHeader=itemHeader uniqueId='id'/> </div> }