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

HUE-4882 [editor] Redraw fixed header on column toggling

Enrico Berti преди 9 години
родител
ревизия
e35d4ed

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

@@ -103,9 +103,8 @@
               if (i >= startRow && i <= endRow) {
                 var row = data[i];
                 if (row) {
-
                   for (var j = 0; j < endCol; j++) {
-                    html += '<td>' + row[j] + '</td>';
+                    html += '<td ' + (!aoColumns[j].bVisible ? 'style="display: none"' : '') +'>' + row[j] + '</td>';
                   }
 
                   if (endCol < aoColumns.length) {

+ 14 - 4
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -2386,16 +2386,26 @@ ${ hueIcons.symbols() }
   }
 
   function toggleAllColumns(linkElement, snippet) {
-    var dt = $(linkElement).parents(".snippet").find("table.resultTable:eq(0)").hueDataTable();
-    $(linkElement).parents(".snippet").find('.filtered-meta li input').each(function (idx, item) {
-      dt.fnSetColumnVis(idx, linkElement.checked, false);
+    var $t = $(linkElement).parents(".snippet").find("table.resultTable:eq(0)");
+    var dt = $t.hueDataTable();
+    $(linkElement).parents(".snippet").find('.filtered-meta td input').each(function (idx, item) {
+      dt.fnSetColumnVis(idx + 1, linkElement.checked, false);
     });
     dt.fnDraw();
+    if ($t.data('plugin_jHueTableExtender')) {
+      $t.data('plugin_jHueTableExtender').drawHeader();
+      $t.data('plugin_jHueTableExtender').drawLockedRows();
+    }
   }
 
   function toggleColumn(linkElement, index, snippet) {
-    var dt = $(linkElement).parents(".snippet").find("table.resultTable:eq(0)").hueDataTable();
+    var $t = $(linkElement).parents(".snippet").find("table.resultTable:eq(0)");
+    var dt = $t.hueDataTable();
     dt.fnSetColumnVis(index, linkElement.checked);
+    if ($t.data('plugin_jHueTableExtender')) {
+      $t.data('plugin_jHueTableExtender').drawHeader();
+      $t.data('plugin_jHueTableExtender').drawLockedRows();
+    }
   }
 
   function scrollToColumn(linkElement, index) {