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
This commit is contained in:
David Huynh 2010-03-10 07:51:34 +00:00
parent a7d4951725
commit f02fd3f5c3

View File

@ -24,7 +24,15 @@ DataTableView.prototype.update = function(onDone) {
DataTableView.prototype.render = function() { DataTableView.prototype.render = function() {
var self = this; 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 = $('<div></div>').addClass("viewPanel-summary").appendTo(container); var divSummary = $('<div></div>').addClass("viewPanel-summary").appendTo(container);
@ -277,6 +285,8 @@ DataTableView.prototype.render = function() {
* Finally, inject the table into the DOM * Finally, inject the table into the DOM
*/ */
$(table).appendTo(tableDiv); $(table).appendTo(tableDiv);
tableDiv[0].scrollLeft = scrollLeft;
}; };
DataTableView.prototype._showRows = function(start, onDone) { DataTableView.prototype._showRows = function(start, onDone) {