Added rowValues as a prop & Readme Updates

This commit is contained in:
Tanner Linsley
2016-10-27 09:20:16 -06:00
parent efeabe3536
commit 92b70393fa
3 changed files with 15 additions and 8 deletions

View File

@@ -151,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>,

11
example/dist/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -372,6 +372,7 @@ export default React.createClass({
{pageRows.map((row, i) => {
const rowInfo = {
row: row.__original,
rowValues: row,
index: row.__index,
viewIndex: i
}
@@ -398,11 +399,11 @@ export default React.createClass({
>
{typeof Cell === 'function' ? (
<Cell
value={rowInfo.row[column.id]}
{...rowInfo}
value={rowInfo.rowValues[column.id]}
/>
) : typeof Cell !== 'undefined' ? Cell
: rowInfo.row[column.id]}
: rowInfo.rowValues[column.id]}
</div>
</TdComponent>
)