Author: dmorozov
Date: 2008-09-12 10:00:52 -0400 (Fri, 12 Sep 2008)
New Revision: 10435
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
Log:
1. Fix selection that dowesn't work at all - it loosed after scrolling
2. Fix unlimited loop jumping of SDT after scrolling under FF3
Modified:
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-09-12
12:51:43 UTC (rev 10434)
+++
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-09-12
14:00:52 UTC (rev 10435)
@@ -6,7 +6,6 @@
ClientUILib.declarePackage("ClientUI.controls.grid.GridBody");
ClientUILib.requireClass("ClientUI.common.box.Box");
-//ClientUILib.requireClass("ClientUI.controls.grid.DataCash");
/*
* GridHeader.js - Grid control header pane
@@ -120,14 +119,6 @@
this.parseTemplate(this.templFrozen.getElement(), this.templNormal.getElement());
- // init cash with initial data
- /*var cash = this.getCash();
- var frows = this.templFrozen.getElement().rows;
- var nrows = this.templNormal.getElement().rows;
- var count = this.rowsCount;
- for(var i=0; i<count; i++) {
- cash.setRow(i, {f: frows[i].innerHTML, n: nrows[i].innerHTML});
- }*/
var gridId = this.grid.getElement().id;
this.fTable = $(gridId + ":f")
this.nTable = $(gridId + ":n")
@@ -139,9 +130,6 @@
if(templNormal && templNormal.rows && templNormal.rows.length != 0) {
this.rowsCount = Math.min(templNormal.rows.length, this.grid.dataModel.getCount());
- //if(ClientUILib.isGecko) {
- // this.defaultRowHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
- //}
this.helpObj = new ClientUI.common.box.Box(templFrozen, null, true);
this.countToLoad = 0;
this.startRow = 0;
@@ -170,9 +158,6 @@
this.defaultRowHeight = defHeight;
}
}
- //if(ClientUILib.isGecko) {
- // this.defaultRowHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
- //}
},
updateLayout: function($super) {
if(!this.controlCreated || !this.grid.controlCreated) {
@@ -393,9 +378,7 @@
ClientUILib.log(ClientUILogger.WARNING, "Start loading: index: " +
startIndex + ", and startRow: " + startRowIndx + ", and count: " +
countToLoad);
this.currRange = range;
this.currentPos = task.pos;
- this.scrollInput.value = task.pos + "," + this.currRange.start +
"," + this.currRange.end+ "," + firstIndex;
-
if (this.grid.options.hideWhenScrolling) {
this.container.hide();
}
@@ -406,28 +389,16 @@
startRow: startRowIndx,
switchType: switchType
};
- var opt = {
- index: options.index,
- count: options.count,
- startRow: options.startRow,
- switchType: options.switchType
- };
- //options = this.processCashedValues(options);
- if(options.count > 0) {
- // Make timer to handle quick clicks on scrollbar arrows
- setTimeout(function() {
-
- // 4. start data loading
- this.updateInterval = screen.updateInterval;
- screen.updateInterval = 1000;
-
- this.grid.dataModel.loadRows(options);
- }.bind(this), 10);
- }
- /*else {
- this.invalidate(opt);
- this.updateStarted = false;
- }*/
+
+ // Make timer to handle quick clicks on scrollbar arrows
+ setTimeout(function() {
+
+ // 4. start data loading
+ this.updateInterval = screen.updateInterval;
+ screen.updateInterval = 1000;
+
+ this.grid.dataModel.loadRows(options);
+ }.bind(this), 10);
}
else {
this.updateStarted = false;
@@ -447,7 +418,6 @@
rearrangeRows: function(options, updateCash, showContainer) {
var frozenTbl = this.templFrozen.getElement();
var normalTbl = this.templNormal.getElement();
- //var cash = this.getCash();
if(options.switchType === 0) {
var visibleRowPos = this.defaultRowHeight * options.index;
@@ -455,17 +425,6 @@
if(showContainer) this._showContainer();
this.templFrozen.moveToY(visibleRowPos);
this.templNormal.moveToY(visibleRowPos);
-
- /*if(updateCash) {
- var frows = frozenTbl.rows;
- var nrows = normalTbl.rows;
- var count = frows.length;
- var index = options.index;
- for(var i=0; i<count; i++) {
- cash.setRow(index+i, {f: frows[i].innerHTML, n: nrows[i].innerHTML});
- }
- }*/
-
this.forceReRender();
}
else if(options.switchType === 1 || options.switchType === 2) {
@@ -528,15 +487,6 @@
this.templNormal.moveToY(visibleRowPos);
}
else {
- /*if(updateCash) {
- var frows = frozenTbl.rows;
- var nrows = normalTbl.rows;
- var count = frows.length;
- var index = options.index;
- for(var i=0; i<count; i++) {
- cash.setRow(index+i, {f: frows[i].innerHTML, n: nrows[i].innerHTML});
- }
- }*/
var visibleRowPos = this.currRange.start * this.defaultRowHeight;
if(showContainer) this._showContainer();
this.templFrozen.moveToY(visibleRowPos);
@@ -558,65 +508,7 @@
this.rearrangeRows(options, true, true);
this.container.show();
this.updateStarted = false;
- /*if(this.processedPos != this.currentPos) {
- this.currentPos = this.processedPos;
- setTimeout(function (){
- this.pendedUpdate();
- }.bind(this), this.grid.dataModel.getRequestDelay());
- }*/
},
- /*pendedUpdate: function() {
- if(this.processedPos != this.currentPos) {
- this.currentPos = this.processedPos;
- setTimeout(function (){
- this.pendedUpdate();
- }.bind(this), this.grid.dataModel.getRequestDelay());
- }
- else {
- this.adjustDataPosition(this.processedPos);
- }
- },*/
- /*getCash: function() {
- if(!this.cash) {
- this.cash = new ClientUI.controls.grid.DataCash(this.grid.dataModel.getCount());
- }
- return this.cash;
- },
- _restoreFromCash: function(options) {
- var count = options.count;
- var index = options.index;
- var startRow = options.startRow;
- var cash = this.getCash();
- var frows = this.templFrozen.getElement().rows;
- var nrows = this.templNormal.getElement().rows;
-
- var row, rowU, i=0;
- var rowC = cash.getRow(index);
- do {
- row = frows[startRow];
- rowU = row.cloneNode(true);
- rowU.innerHTML = rowC.f;
- row.parentNode.replaceChild(rowU, row);
-
- row = nrows[startRow];
- rowU = row.cloneNode(true);
- rowU.innerHTML = rowC.n;
- row.parentNode.replaceChild(rowU, row);
-
- i++;
- startRow++;
- if(startRow >= this.rowsCount) startRow = 0;
- rowC = cash.getRow(index + i);
- } while(i<count && rowC);
-
- setTimeout(function () {
- this.rearrangeRows(options);
- this.container.show();
- this.splash.hide();
- this.updateStarted = false;
-
- }.bind(this), 10);
- },*/
processCashedValues: function(options) {
return options;
@@ -728,7 +620,7 @@
updateScrollState: function() {
this.scrollInput = $(this.gridId + ":si");
var value = this.scrollInput.value;
- if (value !='' && this.currRange.end >=
Number(value.split(',')[2])) {
+ if (value !='' && this.sizeBox.getHeight() <
Number(value.split(',')[0])) {
this.restoreScrollState();
}
this.scrollInput.value = this.currentPos + "," + this.currRange.start +
"," + this.currRange.end+ "," +
this._getRowIndex(this.templNormal.getElement().rows[0].id);
@@ -741,7 +633,7 @@
this.currentPos = values[0];
this.currRange.start = values[1];
this.currRange.end = values[2];
- this.scrollBox.getElement().scrollTop = values[0];
+ this.scrollBox.getElement().scrollTop = this.sizeBox.getHeight(); // values[0];
var visibleRowPos = this.currRange.start * this.defaultRowHeight;
this._showContainer();
this.templFrozen.moveToY(visibleRowPos);