mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-19 08:20:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48e6d16d58 | ||
|
|
e4208e3b0f | ||
|
|
e6d03673ff | ||
|
|
c3fc84db01 | ||
|
|
3334796223 | ||
|
|
92b70393fa | ||
|
|
efeabe3536 | ||
|
|
f018bac58f | ||
|
|
a8f360a408 | ||
|
|
82f3913034 | ||
|
|
cb3cc05a59 | ||
|
|
e8146b5d14 | ||
|
|
eef59a559e | ||
|
|
3b18e8c8c1 | ||
|
|
dd6b8af304 | ||
|
|
f242d2f3f6 | ||
|
|
9dd0333571 |
+3
-1
@@ -1,3 +1,5 @@
|
||||
node_modules/
|
||||
|
||||
lib/
|
||||
react-table.js
|
||||
react-table.css
|
||||
*.log
|
||||
|
||||
@@ -81,6 +81,14 @@ Every React-Table instance requires you to set the `data` prop. To use client-si
|
||||
These are the default props for the main react component `<ReactTable />`
|
||||
```javascript
|
||||
{
|
||||
// General
|
||||
pageSize: 20,
|
||||
minRows: 0, // Ensure this many rows are always rendered, regardless of rows on page
|
||||
|
||||
// Text
|
||||
previousText: 'Previous',
|
||||
nextText: 'Next'
|
||||
|
||||
// Classes
|
||||
className: '-striped -highlight', // The most top level className for the component
|
||||
tableClassName: '', // ClassName for the `table` element
|
||||
@@ -99,17 +107,6 @@ These are the default props for the main react component `<ReactTable />`
|
||||
thStyle: {}, // style object for the `th` component
|
||||
tdStyle: {}, // style object for the `td` component
|
||||
paginationStyle: {}, // style object for the `paginination` component
|
||||
//
|
||||
pageSize: 20,
|
||||
minRows: 0, // Ensure this many rows are always rendered, regardless of rows on page
|
||||
// Global Column Defaults
|
||||
column: { // default properties for every column's model
|
||||
sortable: true,
|
||||
show: true
|
||||
},
|
||||
// Text
|
||||
previousText: 'Previous',
|
||||
nextText: 'Next'
|
||||
}
|
||||
```
|
||||
|
||||
@@ -154,7 +151,12 @@ Every React-Table instance requires a `columns` prop, which is an array of objec
|
||||
style: {}, // Set the style of the `td` element of the column
|
||||
innerClassName: '', // Set the classname of the `.-td-inner` element of the column
|
||||
innerStyle: {}, // Set the style of the `.-td-inner` element of the column
|
||||
render: JSX eg. ({row, value, index, viewIndex}) => <span>{value}</span>, // Provide a JSX element or stateless function to render whatever you want as the column's cell with access to the entire row
|
||||
render: JSX eg. ({value, rowValues, row, index, viewIndex}) => <span>{value}</span>, // Provide a JSX element or stateless function to render whatever you want as the column's cell with access to the entire row
|
||||
// value == the accessed value of the column
|
||||
// rowValues == an object of all of the accessed values for the row
|
||||
// row == the original row of data supplied to the table
|
||||
// index == the original index of the data supplied to the table
|
||||
// viewIndex == the index of the row in the current page
|
||||
|
||||
// Header & HeaderGroup Options
|
||||
header: 'Header Name' or JSX eg. ({data, column}) => <div>Header Name</div>,
|
||||
|
||||
Vendored
+116
-44
File diff suppressed because one or more lines are too long
@@ -21,7 +21,8 @@ export default Component({
|
||||
accessor: 'firstName'
|
||||
}, {
|
||||
header: 'Last Name',
|
||||
accessor: 'lastName'
|
||||
id: 'lastName',
|
||||
accessor: d => d.lastName
|
||||
}]
|
||||
}, {
|
||||
header: 'Info',
|
||||
|
||||
-709
File diff suppressed because one or more lines are too long
+8
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-table",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.7",
|
||||
"description": "A fast, lightweight, opinionated table and datagrid built on React",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/tannerlinsley/react-table#readme",
|
||||
@@ -15,6 +15,12 @@
|
||||
"datagrid"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"react-table.js",
|
||||
"react-table.css",
|
||||
"media/*.png"
|
||||
],
|
||||
"scripts": {
|
||||
"build:node": "babel src --out-dir lib --source-maps inline",
|
||||
"build:css": "rm -rf react-table.css && stylus src/index.styl --use ./node_modules/nib/lib/nib.js --compress -o react-table.css",
|
||||
@@ -41,7 +47,7 @@
|
||||
"nib": "^1.1.2",
|
||||
"npm-run-all": "^3.1.1",
|
||||
"onchange": "^3.0.2",
|
||||
"standard": "8.0.0",
|
||||
"standard": "^8.0.0",
|
||||
"stylus": "^0.54.5",
|
||||
"uglifyify": "3.0.3"
|
||||
},
|
||||
|
||||
File diff suppressed because one or more lines are too long
Vendored
-7
File diff suppressed because one or more lines are too long
+8
-4
@@ -131,7 +131,10 @@ export default React.createClass({
|
||||
throw new Error('A column id is required if using a non-string accessor for column above.')
|
||||
}
|
||||
|
||||
dcol.accessor = d => undefined
|
||||
if (!dcol.accessor) {
|
||||
dcol.accessor = d => undefined
|
||||
}
|
||||
|
||||
return dcol
|
||||
}
|
||||
|
||||
@@ -367,11 +370,12 @@ export default React.createClass({
|
||||
</TheadComponent>
|
||||
<TbodyComponent
|
||||
className={classnames(this.props.tbodyClassName)}
|
||||
style={classnames(this.props.tbodyStyle)}
|
||||
style={this.props.tbodyStyle}
|
||||
>
|
||||
{pageRows.map((row, i) => {
|
||||
const rowInfo = {
|
||||
row: row.__original,
|
||||
rowValues: row,
|
||||
index: row.__index,
|
||||
viewIndex: i
|
||||
}
|
||||
@@ -398,11 +402,11 @@ export default React.createClass({
|
||||
>
|
||||
{typeof Cell === 'function' ? (
|
||||
<Cell
|
||||
value={row[column.id]}
|
||||
{...rowInfo}
|
||||
value={rowInfo.rowValues[column.id]}
|
||||
/>
|
||||
) : typeof Cell !== 'undefined' ? Cell
|
||||
: row[column.id]}
|
||||
: rowInfo.rowValues[column.id]}
|
||||
</div>
|
||||
</TdComponent>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user