Răsfoiți Sursa

HUE-1508 [beeswax] Clicking on a name in Columns tab could go to the result column

Added column links
On tab change the results tab scrolls to the highlighted column by default now
Enrico Berti 12 ani în urmă
părinte
comite
b74278626a
1 a modificat fișierele cu 21 adăugiri și 1 ștergeri
  1. 21 1
      apps/beeswax/src/beeswax/templates/watch_results.mako

+ 21 - 1
apps/beeswax/src/beeswax/templates/watch_results.mako

@@ -208,7 +208,7 @@ ${layout.menubar(section='query')}
             </thead>
             </thead>
             <tbody>
             <tbody>
               % for col in columns:
               % for col in columns:
-                <tr><td>${col}</td></tr>
+                <tr><td><a href="javascript:void(0)" class="column-selector" data-column="${col}">${col}</a></td></tr>
               % endfor
               % endfor
             </tbody>
             </tbody>
           </table>
           </table>
@@ -359,6 +359,26 @@ $(document).ready(function () {
     $(".sidebar-nav").parent().css("margin-left", "0");
     $(".sidebar-nav").parent().css("margin-left", "0");
   });
   });
 
 
+  $(document).on("click", ".column-selector", function () {
+    var _t = $(".resultTable");
+    var _col = _t.find("th:econtains(" + $(this).data("column") + ")");
+    _t.find(".columnSelected").removeClass("columnSelected");
+    _t.find("tr td:nth-child(" + (_col.index() + 1) + ")").addClass("columnSelected");
+    $("a[href='#results']").click();
+  });
+
+  $("a[data-toggle='tab']").on("shown", function (e) {
+    if ($(e.target).attr("href") == "#results" && $(e.relatedTarget).attr("href") == "#columns") {
+      if ($(".resultTable .columnSelected").length > 0) {
+        var _t = $(".resultTable");
+        var _col = _t.find("th:nth-child(" + ($(".resultTable .columnSelected").index() + 1) + ")");
+        _t.parent().animate({
+          scrollLeft: _col.position().left + _t.parent().scrollLeft() - _t.parent().offset().left - 30
+        }, 300);
+      }
+    }
+  });
+
   resizeLogs();
   resizeLogs();
 
 
   $(window).resize(function () {
   $(window).resize(function () {