Просмотр исходного кода

HUE-6256 [presentation] Result grid often not displaying the cells when scrolling

Enrico Berti 8 лет назад
Родитель
Сommit
7d1ef4c

+ 3 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -2698,6 +2698,9 @@ var EditorViewModel = (function() {
         _notebook.type('query-' + options.editor_type);
       }
       _notebook.snippets(_newSnippets);
+      if (_newSnippets.length > 0) {
+        huePubSub.publish('editor.redraw.data', {snippet: _newSnippets[0]});
+      }
     };
     self.togglePresentationMode = function() {
       if (options.editor_type != 'notebook') {

+ 9 - 0
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -3516,6 +3516,15 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
 
       }, HUE_PUB_SUB_EDITOR_ID);
 
+      huePubSub.subscribe('editor.redraw.data', function (options) {
+        hueUtils.waitForRendered("#snippet_" + options.snippet.id() + " .resultTable", function (el) {
+          return el.is(':visible')
+        }, function () {
+          var $el = $("#snippet_" + options.snippet.id()).find(".resultTable");
+          var dt = createDatatable($el, options.snippet, viewModel);
+          dt.fnAddData(options.snippet.result.data());
+        });
+      }, HUE_PUB_SUB_EDITOR_ID);
 
       huePubSub.subscribe('editor.snippet.result.gray', function (snippet) {
         var $snippet = $("#snippet_" + snippet.id());