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.stickyRow = options.stickyHeaders||options.stickyRow;
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)
@ -189,7 +190,6 @@ function TreeGrid(options)
{
this.wrapper.className += ' grid-no-sticky-col';
}
var syncTimer;
addListener(this.tableWrapper, 'scroll', function()
{
if (self.scrolling != 2)
@ -202,10 +202,10 @@ function TreeGrid(options)
}
else
self.scrolling = 0;
if (!syncTimer)
{
syncTimer = setTimeout(function() { self.syncView(); syncTimer = null; }, 100);
}
if (!self.scrollTimeout)
self.syncView();
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, 'mouseout', function(ev) { self.nodeOnHover(false, ev); });