소스 검색

HUE-5003 [core] Prevent JS error on calling scroll to column on just initialized HueDataTables

Enrico Berti 9 년 전
부모
커밋
8a8ba491fd
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      desktop/core/src/desktop/static/desktop/js/jquery.huedatatable.js

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

@@ -513,7 +513,7 @@
           self.$table.data('isScrollAttached', true);
           self.$table.data('isScrollAttached', true);
           var scrollFn = function () {
           var scrollFn = function () {
             window.clearTimeout(drawTimeout);
             window.clearTimeout(drawTimeout);
-            drawTimeout = window.setTimeout(self.fnDraw, Math.max(100, Math.min(self.$table.data('aoColumns').length, 500)));
+            drawTimeout = window.setTimeout(self.fnDraw, Math.max(100, Math.min(self.$table.data('aoColumns') ? self.$table.data('aoColumns').length : 500, 500)));
           }
           }
           self.$table.parents(oInit['scrollable']).data('scrollFnDt', scrollFn);
           self.$table.parents(oInit['scrollable']).data('scrollFnDt', scrollFn);
           self.$table.parents(oInit['scrollable']).on('scroll', scrollFn);
           self.$table.parents(oInit['scrollable']).on('scroll', scrollFn);