@@ -62,6 +62,7 @@ class BaseTable extends React.PureComponent {
6262 } ;
6363 this . columnManager = new ColumnManager ( columns || normalizeColumns ( children ) , props . fixed ) ;
6464
65+ this . _setContainerRef = this . _setContainerRef . bind ( this ) ;
6566 this . _setMainTableRef = this . _setMainTableRef . bind ( this ) ;
6667 this . _setLeftTableRef = this . _setLeftTableRef . bind ( this ) ;
6768 this . _setRightTableRef = this . _setRightTableRef . bind ( this ) ;
@@ -102,6 +103,20 @@ class BaseTable extends React.PureComponent {
102103 this . _scrollbarPresenceChanged = false ;
103104 }
104105
106+ /**
107+ * Get the DOM node of the table
108+ */
109+ getDOMNode ( ) {
110+ return this . tableNode ;
111+ }
112+
113+ /**
114+ * Get the column manager
115+ */
116+ getColumnManager ( ) {
117+ return this . columnManager ;
118+ }
119+
105120 /**
106121 * Get the expanded state, fallback to normal state if not expandable.
107122 */
@@ -182,23 +197,21 @@ class BaseTable extends React.PureComponent {
182197 * Scroll to the specified row.
183198 * By default, the table will scroll as little as possible to ensure the row is visible.
184199 * You can control the alignment of the row though by specifying an align property. Acceptable values are:
185- *
200+ *
186201 * - `auto` (default) - Scroll as little as possible to ensure the row is visible.
187- * (If the row is already visible, it won't scroll at all.)
188- * - `smart` - If the row is already visible, don't scroll at all. If it is less than one viewport away,
189- * scroll as little as possible so that it becomes visible.
190- * If it is more than one viewport away, scroll so that it is centered within the grid.
202+ * - `smart` - Same as `auto` if it is less than one viewport away, or it's the same as`center`.
191203 * - `center` - Center align the row within the table.
192- * - `end` - Align the row to the bottom, right hand side of the table.
193- * - `start` - Align the row to the top, left hand of the table.
204+ * - `end` - Align the row to the bottom side of the table.
205+ * - `start` - Align the row to the top side of the table.
194206
195- * @param {number } rowIndex
196- * @param {string } align
207+ * @param {number } rowIndex
208+ * @param {string } align
197209 */
198210 scrollToRow ( rowIndex = 0 , align = 'auto' ) {
199211 this . table && this . table . scrollToRow ( rowIndex , align ) ;
200212 this . leftTable && this . leftTable . scrollToRow ( rowIndex , align ) ;
201213 this . rightTable && this . rightTable . scrollToRow ( rowIndex , align ) ;
214+ this . scrollToLeft ( 0 ) ;
202215 }
203216
204217 /**
@@ -605,7 +618,7 @@ class BaseTable extends React.PureComponent {
605618 [ `${ classPrefix } --disabled` ] : disabled ,
606619 } ) ;
607620 return (
608- < div className = { cls } style = { containerStyle } >
621+ < div ref = { this . _setContainerRef } className = { cls } style = { containerStyle } >
609622 { this . renderFooter ( ) }
610623 { this . renderMainTable ( ) }
611624 { this . renderLeftTable ( ) }
@@ -660,6 +673,10 @@ class BaseTable extends React.PureComponent {
660673 return `${ this . props . classPrefix } __${ className } ` ;
661674 }
662675
676+ _setContainerRef ( ref ) {
677+ this . tableNode = ref ;
678+ }
679+
663680 _setMainTableRef ( ref ) {
664681 this . table = ref ;
665682 }
0 commit comments