mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-12 04:50:20 +00:00
Fixed index to point to original index, added viewIndex
This commit is contained in:
@@ -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
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+5
-3
@@ -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]}
|
||||
|
||||
Reference in New Issue
Block a user