Fixed index to point to original index, added viewIndex

This commit is contained in:
Tanner Linsley
2016-10-25 23:36:59 -06:00
parent 7700f6a1a0
commit e930d834c6
4 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -172,7 +172,7 @@ Or just define them on the component
className: '', // Set the classname of the `th/td` element of the column
innerClassName: '', // Set the classname of the `.th-inner/.td-inner` element of the column
columns: [...] // See Header Groups section below
render: JSX eg. ({row, value, index}) => <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. ({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
sortable: true,
sort: 'asc' or 'desc',
show: true,
+6 -4
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -3
View File
@@ -196,9 +196,10 @@ export default React.createClass({
}
},
accessData (data) {
return data.map((d) => {
return data.map((d, i) => {
const row = {
__original: d
__original: d,
__index: i
}
this.decoratedColumns.forEach(column => {
row[column.id] = column.accessor(d)
@@ -337,7 +338,8 @@ export default React.createClass({
<Cell
value={row[column.id]}
row={row.__original}
index={i}
index={row.__index}
viewIndex={i}
/>
) : typeof Cell !== 'undefined' ? Cell
: row[column.id]}