File tree Expand file tree Collapse file tree 5 files changed +51
-2
lines changed Expand file tree Collapse file tree 5 files changed +51
-2
lines changed Original file line number Diff line number Diff line change 22
33## NEXT VERSION
44
5+ - fix: ` scrollToRow ` doesn't work regression introduced in #73
6+
57## v1.7.0 (2019-08-06)
68
79- chore: remove the use of ` Object.values `
Original file line number Diff line number Diff line change @@ -211,7 +211,6 @@ class BaseTable extends React.PureComponent {
211211 this . table && this . table . scrollToRow ( rowIndex , align ) ;
212212 this . leftTable && this . leftTable . scrollToRow ( rowIndex , align ) ;
213213 this . rightTable && this . rightTable . scrollToRow ( rowIndex , align ) ;
214- this . scrollToLeft ( 0 ) ;
215214 }
216215
217216 /**
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class GridTable extends React.PureComponent {
4040 }
4141
4242 scrollToRow ( rowIndex = 0 , align = 'auto' ) {
43- this . bodyRef && this . bodyRef . scrollToItem ( { rowIndex, columnIndex : 0 , align } ) ;
43+ this . bodyRef && this . bodyRef . scrollToItem ( { rowIndex, align } ) ;
4444 }
4545
4646 renderRow ( args ) {
Original file line number Diff line number Diff line change @@ -204,5 +204,9 @@ module.exports = {
204204 title : 'Inline Editing' ,
205205 path : '/examples/inline-editing' ,
206206 } ,
207+ {
208+ title : 'Scroll Methods' ,
209+ path : '/examples/scroll-to' ,
210+ } ,
207211 ] ,
208212}
Original file line number Diff line number Diff line change 1+ const columns = generateColumns ( 10 )
2+ const data = generateData ( columns , 500 )
3+
4+ const Button = styled . button `
5+ padding: 4px 8px;
6+ margin: 10px;
7+ `
8+
9+ export default class App extends React . Component {
10+ setRef = ref => ( this . table = ref )
11+
12+ render ( ) {
13+ return (
14+ < >
15+ < Button onClick = { ( ) => this . table . scrollToRow ( 100 , 'auto' ) } >
16+ scrollToRow(100, 'auto')
17+ </ Button >
18+ < Button onClick = { ( ) => this . table . scrollToRow ( 200 , 'start' ) } >
19+ scrollToRow(200, 'start')
20+ </ Button >
21+ < Button onClick = { ( ) => this . table . scrollToRow ( 300 , 'center' ) } >
22+ scrollToRow(300, 'center')
23+ </ Button >
24+ < Button onClick = { ( ) => this . table . scrollToRow ( 400 , 'end' ) } >
25+ scrollToRow(400, 'end')
26+ </ Button >
27+ < Button onClick = { ( ) => this . table . scrollToLeft ( 400 ) } >
28+ scrollToLeft(400)
29+ </ Button >
30+ < Button onClick = { ( ) => this . table . scrollToTop ( 400 ) } >
31+ scrollToTop(400)
32+ </ Button >
33+ < Button
34+ onClick = { ( ) =>
35+ this . table . scrollToPosition ( { scrollLeft : 200 , scrollTop : 2000 } )
36+ }
37+ >
38+ { 'scrollToPosition({ scrollLeft: 200, scrollTop: 2000 })' }
39+ </ Button >
40+ < Table ref = { this . setRef } fixed columns = { columns } data = { data } />
41+ </ >
42+ )
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments