File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ class MainContainerController extends ComponentController {
260260 id = selectionModel . getRowId ( activeView . store . indexOf ( value . country ) ) ;
261261 selectionModel . select ( id ) ;
262262
263- Neo . main . DomAccess . scrollIntoView ( { id : id } ) ;
263+ Neo . main . DomAccess . scrollToTableRow ( { id : id } ) ;
264264 } else if ( activeView . ntype === 'helix' ) {
265265 selectionModel . select ( value . country , false ) ;
266266 } else {
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class DomAccess extends Base {
5555 'getBoundingClientRect' ,
5656 'markdownToHtml' ,
5757 'scrollIntoView' ,
58+ 'scrollToTableRow' ,
5859 'selectNode' ,
5960 'swapStyleSheet' ,
6061 'windowScrollTo'
@@ -358,6 +359,32 @@ class DomAccess extends Base {
358359 return { id : data . id } ;
359360 }
360361
362+ /**
363+ *
364+ * @param {Object } data
365+ * @param {String } data.id
366+ * @param {String } [data.behavior='smooth']
367+ * @param {String } [data.offset=34]
368+ * @returns {Object } obj.id => the passed id
369+ */
370+ scrollToTableRow ( data ) {
371+ let node = this . getElement ( data . id ) ; // tr tag
372+
373+ if ( node ) {
374+ let tableNode = node . parentNode . parentNode ,
375+ wrapperNode = tableNode . parentNode ,
376+ tableTop = tableNode . getBoundingClientRect ( ) . top ,
377+ top = node . getBoundingClientRect ( ) . top ;
378+
379+ wrapperNode . scrollTo ( {
380+ top : top - tableTop - ( data . hasOwnProperty ( 'offset' ) ? data . offset : 34 ) ,
381+ behavior : data . behavior || 'smooth'
382+ } ) ;
383+ }
384+
385+ return { id : data . id } ;
386+ }
387+
361388 /**
362389 *
363390 * @param {Object } data
You can’t perform that action at this time.
0 commit comments