فهرست منبع

HUE-1954 [beeswax] The result table header doesn't move on scroll or resize

Fixed corner cases
Removed specific IE9 scroll behavior
Enrico Berti 11 سال پیش
والد
کامیت
e59bc5c
2فایلهای تغییر یافته به همراه5 افزوده شده و 15 حذف شده
  1. 4 15
      apps/beeswax/src/beeswax/templates/execute.mako
  2. 1 0
      desktop/core/static/js/jquery.tablescroller.js

+ 4 - 15
apps/beeswax/src/beeswax/templates/execute.mako

@@ -1646,7 +1646,6 @@ function cleanResultsTable() {
 }
 
 function addResults(viewModel, dataTable, index, pageSize) {
-  var _scrollPos = $("#results .dataTables_wrapper").data("scrollPosition");
   if (viewModel.hasMoreResults() && index + pageSize > viewModel.design.results.rows().length) {
     $(document).one('fetched.results', function () {
       $.totalStorage("${app_name}_temp_query", null);
@@ -1656,15 +1655,6 @@ function addResults(viewModel, dataTable, index, pageSize) {
   } else {
     dataTable.fnAddData(viewModel.design.results.rows.slice(index, index + pageSize));
   }
-  if ($.browser.msie){
-    if (_scrollPos != null && typeof _scrollPos != "undefined"){
-      window.setTimeout(function(){
-        $("#results .dataTables_wrapper").scrollTop(_scrollPos);
-        $(".spinner").hide();
-        $("#results .dataTables_wrapper").animate({opacity: '1'}, 50);
-      }, 1000)
-    }
-  }
 }
 
 function resultsTable(e, data) {
@@ -1712,18 +1702,17 @@ function resultsTable(e, data) {
     var pageSize = 100;
     var _scrollTimeout = -1;
     dataTableEl.on("scroll", function (e) {
+      var _lastScrollPosition = dataTableEl.data("scrollPosition") != null ? dataTableEl.data("scrollPosition") : 0;
       window.clearTimeout(_scrollTimeout);
       _scrollTimeout = window.setTimeout(function(){
         dataTableEl.data("scrollPosition", dataTableEl.scrollTop());
-        if (dataTableEl.scrollTop() + dataTableEl.outerHeight() + 20 > dataTableEl[0].scrollHeight && dataTable) {
+        if (_lastScrollPosition !=  dataTableEl.scrollTop() && dataTableEl.scrollTop() + dataTableEl.outerHeight() + 20 > dataTableEl[0].scrollHeight && dataTable) {
           dataTableEl.animate({opacity: '0.55'}, 200);
           $(".spinner").show();
           addResults(viewModel, dataTable, index, pageSize);
           index += pageSize;
-          if (typeof $.browser.msie == "undefined"){
-            $(".spinner").hide();
-            dataTableEl.animate({opacity: '1'}, 50);
-          }
+          $(".spinner").hide();
+          dataTableEl.animate({opacity: '1'}, 50);
         }
       }, 100);
     });

+ 1 - 0
desktop/core/static/js/jquery.tablescroller.js

@@ -73,6 +73,7 @@
   function resizeScrollingTable(_this) {
     var el = _this.element;
     $(el).css("overflow-y", "").css("height", "");
+    $(el).css("overflow-x", "auto");
     var heightAfter = _this.options.heightAfterCorrection;
     $(el).nextAll(":visible").each(function () {
       heightAfter += $(this).outerHeight(true);