Преглед на файлове

HUE-4910 [editor] Fix issue where headers become scrambled after viewing the graph

Johan Ahlen преди 9 години
родител
ревизия
2e10e7e

+ 12 - 15
desktop/core/src/desktop/static/desktop/js/jquery.tableextender2.js

@@ -60,7 +60,7 @@
       firstCellWidth = self.options.fixedFirstColumn ? self.firstColumnTopCell.outerWidth() : 0;
       for (thi = 0; thi < self.thMapping.length; thi++) {
         th = self.thMapping[thi];
-        if (!th.visible) {
+        if (!th.original.is(':visible')) {
           continue;
         }
         leftPosition = th.clone.position().left - firstCellWidth;
@@ -129,7 +129,7 @@
       }
       for (thi = 0; thi < self.thMapping.length; thi++) {
         th = self.thMapping[thi];
-        if (!th.visible) {
+        if (!th.original.is(':visible')) {
           continue;
         }
         if (th.clone.lastWidth !== th.original.width()) {
@@ -282,25 +282,21 @@
     var totalThWidth = 0;
     self.$element.find("thead>tr th").each(function (i) {
       var originalTh = $(this);
-      var visible = originalTh.is(':visible');
       originalTh.removeAttr("data-bind");
       var clonedTh = $(clonedThs[i]).css("background-color", "#FFFFFF");
-      if (visible) {
-        clonedTh.click(function () {
-          originalTh.click();
-          if (self.options.headerSorting) {
-            clonedThs.attr("class", "sorting");
-          }
-          $(this).attr("class", originalTh.attr("class"));
-        });
-      }
+      clonedTh.click(function () {
+        originalTh.click();
+        if (self.options.headerSorting) {
+          clonedThs.attr("class", "sorting");
+        }
+        $(this).attr("class", originalTh.attr("class"));
+      });
       clonedTh.width(originalTh.width());
       totalThWidth += originalTh.width();
       self.thMapping.push({
         original: originalTh,
         clone: clonedTh,
-        cloneSpan: clonedTh.children().first(),
-        visible: visible
+        cloneSpan: clonedTh.children().first()
       })
     });
 
@@ -314,7 +310,7 @@
       topPosition = self.$parent.offset().top - self.$mainScrollable.scrollTop();
     }
     var headerRowContainer = $("<div>").attr("id", self.$element.attr("id") + "jHueTableExtenderClonedContainer")
-        .addClass("jHueTableExtenderClonedContainer").width(totalThWidth).css("overflow-x", "hidden")
+        .addClass("jHueTableExtenderClonedContainer").width(totalThWidth).css("overflow-x", "hidden");
     if (!self.options.disableTopPosition) {
       headerRowContainer.css("top", topPosition + "px");
     }
@@ -328,6 +324,7 @@
     headerRowContainer.scrollLeft(self.$parent.scrollLeft());
 
     self.headerRowContainer = headerRowContainer;
+    self.$mainScrollable.trigger('scroll');
   };
 
   Plugin.prototype.drawFirstColumn = function () {

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

@@ -2046,7 +2046,7 @@ ${ hueIcons.symbols() }
 <script type="text/html" id="snippet-result-controls">
   <div class="snippet-actions" style="opacity:1">
     <div style="margin-top:25px;">
-      <a class="snippet-side-btn" href="javascript: void(0)" data-bind="click: function() { $data.showGrid(true); huePubSub.publish('redraw.fixed.headers'); }, css: {'active': $data.showGrid}" title="${ _('Grid') }">
+      <a class="snippet-side-btn" href="javascript: void(0)" data-bind="click: function() { $data.showGrid(true); huePubSub.publish('redraw.fixed.headers'); huePubSub.publish('table.extender.redraw'); }, css: {'active': $data.showGrid}" title="${ _('Grid') }">
         <i class="fa fa-fw fa-th"></i>
       </a>
     </div>