Browse Source

HUE-4511 [editor] Field scroll does not scroll or grey the column

Enrico Berti 9 years ago
parent
commit
ac40704

+ 7 - 5
desktop/core/src/desktop/static/desktop/js/jquery.huedatatable.js

@@ -186,6 +186,7 @@
       colSel = $t.find("tr td:nth-child(" + (col + 1) + ")");
       $t.data('scrollToCol', col);
       $t.data('scrollToRow', row);
+      $t.data('scrollAnimate', true);
       $t.parent().trigger('scroll');
     }
 
@@ -271,18 +272,19 @@
 
           if ($t.data('scrollToCol')) {
             var colSel = $t.find("tr th:nth-child(" + ($t.data('scrollToCol') + 1) + ")");
-            $t.parent().animate({
-              scrollLeft: colSel.position().left + $t.parent().scrollLeft() - $t.parent().offset().left - 30
-            }, 300);
             colSel = $t.find("tr td:nth-child(" + ($t.data('scrollToCol') + 1) + ")");
+            if ($t.data('scrollAnimate')) {
+              $t.parent().animate({
+                scrollLeft: colSel.position().left + $t.parent().scrollLeft() - $t.parent().offset().left - 30
+              }, 300);
+              $t.data('scrollAnimate', null);
+            }
             if ($t.data('scrollToRow') == null) {
               colSel.addClass("columnSelected");
             }
             else {
               $t.find("tr:nth-child(" + ($t.data('scrollToRow') + 1) + ") td:nth-child(" + ($t.data('scrollToCol') + 1) + ")").addClass('columnSelected');
-              $t.data('scrollToRow', null);
             }
-            $t.data('scrollToCol', null);
           }
 
           if ($t.data('plugin_jHueTableExtender')) {

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

@@ -2422,11 +2422,13 @@ ${ hueIcons.symbols() }
     _t.find(".columnSelected").removeClass("columnSelected");
     var _colSel = _t.find("tr th:nth-child(" + (_col.index() + 1) + ")");
     if (_colSel.length > 0) {
-      _colSel.addClass("columnSelected");
+      _t.find("tr td:nth-child(" + (_col.index() + 1) + ")").addClass("columnSelected");
       _t.parent().animate({
         scrollLeft: _colSel.position().left + _t.parent().scrollLeft() - _t.parent().offset().left - 30
       }, 300, function(){
         _t.data('scrollToCol', _col.index());
+        _t.data('scrollToRow', null);
+        _t.data('scrollAnimate', true);
         _t.parent().trigger('scroll');
       });
     }