From f02fd3f5c378d7f0e1bfd922aa0999c257e8942e Mon Sep 17 00:00:00 2001 From: David Huynh Date: Wed, 10 Mar 2010 07:51:34 +0000 Subject: [PATCH] Try to keep the same scrolling position in the data table view when it gets re-rendered. git-svn-id: http://google-refine.googlecode.com/svn/trunk@269 7d457c2a-affb-35e4-300a-418c747d4874 --- src/main/webapp/scripts/views/data-table-view.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/scripts/views/data-table-view.js b/src/main/webapp/scripts/views/data-table-view.js index 6c43cfb5c..2de459844 100644 --- a/src/main/webapp/scripts/views/data-table-view.js +++ b/src/main/webapp/scripts/views/data-table-view.js @@ -24,7 +24,15 @@ DataTableView.prototype.update = function(onDone) { DataTableView.prototype.render = function() { var self = this; - var container = this._div.empty(); + var container = this._div; + + var scrollLeft = 0; + var oldTableDiv = container.find(".data-table-container"); + if (oldTableDiv.length > 0) { + scrollLeft = oldTableDiv[0].scrollLeft; + } + + container.empty(); var divSummary = $('
').addClass("viewPanel-summary").appendTo(container); @@ -277,6 +285,8 @@ DataTableView.prototype.render = function() { * Finally, inject the table into the DOM */ $(table).appendTo(tableDiv); + + tableDiv[0].scrollLeft = scrollLeft; }; DataTableView.prototype._showRows = function(start, onDone) {