Эх сурвалжийг харах

HUE-4604 [editor] Locked rows does not go well with headers

Enrico Berti 9 жил өмнө
parent
commit
14680cd

+ 1 - 0
desktop/core/src/desktop/static/desktop/js/jquery.huedatatable.js

@@ -325,6 +325,7 @@
 
           if (force) {
             $t.data('plugin_jHueTableExtender').drawFirstColumn();
+            $t.data('plugin_jHueTableExtender').drawLockedRows();
           }
 
         }

+ 10 - 4
desktop/core/src/desktop/static/desktop/js/jquery.tableextender.js

@@ -221,7 +221,9 @@
     $headerCounter.addClass('locked');
 
     function unlock($el) {
-      $header.find('tr.ht-visible-row-' + (($el.text() * 1) - 1)).remove();
+      $header.find('tr td:first-child').filter(function () {
+        return $(this).text() === rowNo + '';
+      }).closest('tr').remove();
       delete lockedRows['r' + $el.text()]
       $el.parent().remove();
       if ($header.find('tbody tr').length == 0) {
@@ -234,9 +236,13 @@
       if (force) {
         unlock(lockedRows['r' + rowNo].cell.find('td'));
       }
-      var $clone = $pluginElement.find('tr td:first-child').filter(function () {
-        return $(this).text() === rowNo + '';
-      }).closest('tr').clone();
+      var $clone = $('<tr>');
+      var tHtml = '';
+      var aoColumns = $pluginElement.data('aoColumns');
+      $pluginElement.data('data')[rowNo - 1].forEach(function(col, idx){
+        tHtml += '<td ' + (aoColumns && !aoColumns[idx].bVisible ? 'style="display: none"' : '') + '>' + col + '</td>';
+      });
+      $clone.html(tHtml);
       $clone.addClass('locked');
       $clone.appendTo($header.find('tbody'));
       $pluginElement.data('lockedRows', lockedRows);

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

@@ -2860,6 +2860,7 @@ ${ hueIcons.symbols() }
               $('.right-panel').trigger('scroll');
               if (_el.data('plugin_jHueTableExtender')) {
                 _el.data('plugin_jHueTableExtender').drawHeader();
+                _el.data('plugin_jHueTableExtender').drawLockedRows();
               }
             }
           }
@@ -3344,7 +3345,6 @@ ${ hueIcons.symbols() }
       $(document).on("toggleResultSettings", function (e, snippet) {
         window.setTimeout(function () {
           $('#snippet_' + snippet.id()).find('.chart').trigger("forceUpdate");
-          redrawFixedHeaders();
           $('#snippet_' + snippet.id()).find('.snippet-grid-settings').mCustomScrollbar('update');
           $('#snippet_' + snippet.id()).find('.snippet-grid-settings').mCustomScrollbar('scrollTo', 'left', {
             scrollInertia: 0
@@ -3355,6 +3355,7 @@ ${ hueIcons.symbols() }
           else {
             $("#snippet_" + snippet.id()).find('.table-results .grid-side').width('100%');
           }
+          redrawFixedHeaders();
         }, 10)
       });