瀏覽代碼

HUE-4696 [editor] JS .top error on certain reload/execute combos

Enrico Berti 9 年之前
父節點
當前提交
83ff7e7
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      desktop/libs/notebook/src/notebook/templates/editor_components.mako

+ 5 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -2364,7 +2364,11 @@ ${ hueIcons.symbols() }
           window.clearTimeout(resultFollowTimeout);
           resultFollowTimeout = window.setTimeout(function () {
             var topCoord = vm.isPlayerMode() ? 1 : 73;
-            var margin = Math.max(((snippetEl.find('.dataTables_wrapper').offset().top - topCoord) * -1), 0);
+            var offsetTop = 0;
+            if (snippetEl.find('.dataTables_wrapper').length > 0 && snippetEl.find('.dataTables_wrapper').offset()){
+              offsetTop = (snippetEl.find('.dataTables_wrapper').offset().top - topCoord) * -1;
+            }
+            var margin = Math.max(offsetTop, 0);
             if (snippet.isResultSettingsVisible()) {
               snippetEl.find('.snippet-grid-settings').css({
                 "height": Math.ceil($(window).height() - Math.max($('#queryResults').offset().top, topCoord)) + 'px'