Skip to content

Commit

Permalink
improve performance of scrolling
Browse files Browse the repository at this point in the history
Thanks @cwebster2 (https://github.com/cwebster2) for reporting the
problem. See #215 for more
details.
  • Loading branch information
OlegKi committed Mar 3, 2016
1 parent de0ba46 commit 629d16f
Show file tree
Hide file tree
Showing 6 changed files with 282 additions and 286 deletions.
26 changes: 12 additions & 14 deletions js/grid.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Dual licensed under the MIT and GPL licenses
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl-2.0.html
* Date: 2016-03-02
* Date: 2016-03-03
*/
//jsHint options
/*jshint eqnull:true */
Expand Down Expand Up @@ -3001,25 +3001,22 @@
}
}
},
scrollGrid: function (e) { // this must be bDiv
var bDiv = this, $bTable = getGridComponent(COMPONENT_NAMES.BODY_TABLE, bDiv);
if (e) { e.stopPropagation(); }
if ($bTable.length === 0) { return true; }
var gridSelf = $bTable[0].grid;
scrollGrid: function () { // this must be bDiv
if (p.scroll) {
var scrollTop = bDiv.scrollTop;
var scrollTop = this.scrollTop;
// save last scrollTop of bDiv as property of grid object
if (gridSelf.scrollTop === undefined) { gridSelf.scrollTop = 0; }
if (scrollTop !== gridSelf.scrollTop) {
gridSelf.scrollTop = scrollTop;
if (gridSelf.timer) { clearTimeout(gridSelf.timer); }
gridSelf.timer = setTimeout(function () { gridSelf.populateVisible.call($bTable[0]); }, p.scrollTimeout);
if (grid.scrollTop === undefined) { grid.scrollTop = 0; }
if (scrollTop !== grid.scrollTop) {
grid.scrollTop = scrollTop;
if (grid.timer) { clearTimeout(grid.timer); }
grid.timer = setTimeout(function () { grid.populateVisible.call(ts); }, p.scrollTimeout);
}
}
gridSelf.hDiv.scrollLeft = bDiv.scrollLeft;
grid.hDiv.scrollLeft = this.scrollLeft;
if (p.footerrow) {
gridSelf.sDiv.scrollLeft = bDiv.scrollLeft;
grid.sDiv.scrollLeft = this.scrollLeft;
}
return false;
},
selectionPreserver: function () {
var self = this, $self = $(self), sr = p.selrow, sra = p.selarrrow ? $.makeArray(p.selarrrow) : null,
Expand Down Expand Up @@ -5231,6 +5228,7 @@
if (bDiv) {
bDiv.scrollLeft = this.scrollLeft;
}
return false;
});
$(hb).append(hTable);
hTable = null;
Expand Down

0 comments on commit 629d16f

Please sign in to comment.