Make scroll sync timeout optional

master
Vitaliy Filippov 2017-07-10 15:02:46 +03:00
parent 9d8f352037
commit 68ee12f7e7
1 changed files with 6 additions and 6 deletions

View File

@ -100,7 +100,8 @@ function TreeGrid(options)
this.wrapper = document.createElement('div'); this.wrapper = document.createElement('div');
this.stickyRow = options.stickyHeaders||options.stickyRow; this.stickyRow = options.stickyHeaders||options.stickyRow;
this.stickyColumn = options.stickyHeaders||options.stickyColumn; this.stickyColumn = options.stickyHeaders||options.stickyColumn;
this.minItemHeight = 21; this.minItemHeight = options.minItemHeight||21;
this.scrollTimeout = options.scrollTimeout||0;
if (this.stickyRow || this.stickyColumn) if (this.stickyRow || this.stickyColumn)
{ {
if (this.stickyRow && this.stickyColumn) if (this.stickyRow && this.stickyColumn)
@ -189,7 +190,6 @@ function TreeGrid(options)
{ {
this.wrapper.className += ' grid-no-sticky-col'; this.wrapper.className += ' grid-no-sticky-col';
} }
var syncTimer;
addListener(this.tableWrapper, 'scroll', function() addListener(this.tableWrapper, 'scroll', function()
{ {
if (self.scrolling != 2) if (self.scrolling != 2)
@ -202,10 +202,10 @@ function TreeGrid(options)
} }
else else
self.scrolling = 0; self.scrolling = 0;
if (!syncTimer) if (!self.scrollTimeout)
{ self.syncView();
syncTimer = setTimeout(function() { self.syncView(); syncTimer = null; }, 100); else if (!self.scrollSyncTimer)
} self.scrollSyncTimer = setTimeout(function() { self.syncView(); self.scrollSyncTimer = null; }, self.scrollTimeout);
}); });
addListener(this.wrapper||this.table, 'mouseover', function(ev) { self.nodeOnHover(true, ev); }); addListener(this.wrapper||this.table, 'mouseover', function(ev) { self.nodeOnHover(true, ev); });
addListener(this.wrapper||this.table, 'mouseout', function(ev) { self.nodeOnHover(false, ev); }); addListener(this.wrapper||this.table, 'mouseout', function(ev) { self.nodeOnHover(false, ev); });