Browse Source

[beeswax] force scroller to work

Add logic to retry scroller until it resizes.
Abraham Elmahrek 12 years ago
parent
commit
8313e81
1 changed files with 11 additions and 3 deletions
  1. 11 3
      apps/beeswax/src/beeswax/templates/execute.mako

+ 11 - 3
apps/beeswax/src/beeswax/templates/execute.mako

@@ -948,8 +948,10 @@ function getHighlightedQuery() {
   return null;
   return null;
 }
 }
 
 
-function reinitializeTable () {
-  window.setTimeout(function(){
+function reinitializeTable(max) {
+  var _max = max || 10;
+
+  function fn(){
     $(".dataTables_wrapper").jHueTableScroller({
     $(".dataTables_wrapper").jHueTableScroller({
       minHeight: $(window).height() - 190,
       minHeight: $(window).height() - 190,
       heightAfterCorrection: 0
       heightAfterCorrection: 0
@@ -963,7 +965,13 @@ function reinitializeTable () {
     $(".dataTables_wrapper").jHueScrollUp({
     $(".dataTables_wrapper").jHueScrollUp({
       secondClickScrollToTop: true
       secondClickScrollToTop: true
     });
     });
-  }, 400)
+
+    if ($(".dataTables_wrapper").data('original-height') == 0 && --_max != 0) {
+      $(".dataTables_wrapper").data('original-height', $(".dataTables_wrapper").height());
+      window.setTimeout(fn, 100);
+    }
+  }
+  window.setTimeout(fn, 100);
 }
 }
 
 
 $(document).ready(function () {
 $(document).ready(function () {