From 1e134bb4701d9d1f04f946d282744567c13ba6ff Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 16 Jan 2009 10:18:31 -0700 Subject: [PATCH] Fix viewport position when switching to cached view. --- imp/js/src/ViewPort.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/imp/js/src/ViewPort.js b/imp/js/src/ViewPort.js index e0bbc7ddc..336b470aa 100644 --- a/imp/js/src/ViewPort.js +++ b/imp/js/src/ViewPort.js @@ -116,21 +116,25 @@ var ViewPort = Class.create({ this.views.unset(view); }, - // rownum = Row number - // noupdate = boolean - scrollTo: function(rownum, noupdate) + // rownum = (integer) Row number + // noupdate = (Object) + scrollTo: function(rownum, opts) { var s = this.scroller; + opts = opts || {}; - s.noupdate = noupdate; + s.noupdate = opts.noupdate; switch (this.isVisible(rownum)) { case -1: s.moveScroll(rownum - 1); break; - // case 0: - // noop + case 0: + if (opts.top) { + s.moveScroll(rownum - 1); + } + break; case 1: s.moveScroll(Math.min(rownum, this.getMetaData('total_rows') - this.getPageSize() + 1)); @@ -682,7 +686,7 @@ var ViewPort = Class.create({ } this.scroller.updateSize(); - this.scrollTo(offset + 1, true); + this.scrollTo(offset + 1, { noupdate: true, top: true }); offset = this.currentOffset(); rows = this.createSelection('rownum', $A($R(offset + 1, offset + page_size))); -- 2.11.0