@@ -87,25 +87,31 @@ export default React.createClass({
87
87
// Pagination
88
88
const startRow = pageSize * page
89
89
const endRow = startRow + pageSize
90
- const pageRows = manual ? resolvedData : sortedData . slice ( startRow , endRow )
90
+ let pageRows = manual ? resolvedData : sortedData . slice ( startRow , endRow )
91
91
const minRows = this . getMinRows ( )
92
92
const padRows = _ . range ( Math . max ( minRows - pageRows . length , 0 ) )
93
93
94
94
const hasColumnFooter = allVisibleColumns . some ( d => d . footer )
95
95
96
96
const recurseRowsViewIndex = ( rows , path = [ ] , index = - 1 ) => {
97
- rows . forEach ( ( row , i ) => {
98
- index ++
99
- row . _viewIndex = index
100
- const newPath = path . concat ( [ i ] )
101
- if ( row [ subRowsKey ] && _ . get ( expandedRows , newPath ) ) {
102
- index = recurseRowsViewIndex ( row [ subRowsKey ] , newPath , index )
103
- }
104
- } )
105
- return index
97
+ return [
98
+ rows . map ( ( row , i ) => {
99
+ index ++
100
+ const rowWithViewIndex = {
101
+ ...row ,
102
+ _viewIndex : index
103
+ }
104
+ const newPath = path . concat ( [ i ] )
105
+ if ( rowWithViewIndex [ subRowsKey ] && _ . get ( expandedRows , newPath ) ) {
106
+ [ rowWithViewIndex [ subRowsKey ] , index ] = recurseRowsViewIndex ( rowWithViewIndex [ subRowsKey ] , newPath , index )
107
+ }
108
+ return rowWithViewIndex
109
+ } ) ,
110
+ index
111
+ ]
106
112
}
107
113
108
- recurseRowsViewIndex ( pageRows )
114
+ [ pageRows ] = recurseRowsViewIndex ( pageRows )
109
115
110
116
const canPrevious = page > 0
111
117
const canNext = page + 1 < pages
0 commit comments