Fixed code for auto-reducing the grid rows, removed debug messages

This commit is contained in:
Andreas Stöckel 2011-09-05 09:13:58 +00:00
parent 7ab7b51bc8
commit a13dfef19e
4 changed files with 11 additions and 18 deletions

View File

@ -28,7 +28,7 @@ var ET2_GRID_VIEW_EXT = 25;
/** /**
* Determines the timeout after which the scroll-event is processed. * Determines the timeout after which the scroll-event is processed.
*/ */
var ET2_GRID_SCROLL_TIMEOUT = 100; var ET2_GRID_SCROLL_TIMEOUT = 25;
var partitionTree = null; var partitionTree = null;
@ -156,13 +156,11 @@ var et2_dataview_grid = Class.extend(et2_dataview_IViewRange, {
if (displayTop > reduceHeight) if (displayTop > reduceHeight)
{ {
console.log("/\\");
this._partitionTree.reduceRange(et2_bounds(0, displayTop - reduceHeight)); this._partitionTree.reduceRange(et2_bounds(0, displayTop - reduceHeight));
} }
if (displayBottom + reduceHeight < this._partitionTree.getHeight()) if (displayBottom + reduceHeight < this._partitionTree.getHeight())
{ {
console.log("\\/");
this._partitionTree.reduceRange(et2_bounds(displayBottom + reduceHeight, this._partitionTree.reduceRange(et2_bounds(displayBottom + reduceHeight,
this._partitionTree.getHeight())); this._partitionTree.getHeight()));
} }

View File

@ -129,7 +129,6 @@ var et2_dataview_gridContainer = Class.extend({
// Rebuild the column stylesheets // Rebuild the column stylesheets
this.columnMgr.setTotalWidth(_w - this.scrollbarWidth); this.columnMgr.setTotalWidth(_w - this.scrollbarWidth);
et2_debug("log", _w - this.scrollbarWidth);
this._updateColumns(); this._updateColumns();
} }
@ -305,9 +304,6 @@ var et2_dataview_gridContainer = Class.extend({
totalWidth += col.width; totalWidth += col.width;
et2_debug("log", col.divClass, " cw: ", columnWidth, " hw: ",
headerWidth, " tw: ", totalWidth);
first = false; first = false;
} }
else else
@ -412,10 +408,6 @@ var et2_dataview_gridContainer = Class.extend({
this.columnBorderWidth = this.constructor.prototype.columnBorderWidth = this.columnBorderWidth = this.constructor.prototype.columnBorderWidth =
this._getColumnBorderWidth(clone); this._getColumnBorderWidth(clone);
et2_debug("log", "Scrollbar width: ", this.scrollbarWidth);
et2_debug("log", "Header border width: ", this.headerBorderWidth);
et2_debug("log", "Column border width: ", this.columnBorderWidth);
// Remove the cloned DOM-Node again from the outer body // Remove the cloned DOM-Node again from the outer body
clone.remove(); clone.remove();
} }

View File

@ -561,7 +561,7 @@ var et2_dataview_partitionOrganizationNode = et2_dataview_partitionNode.extend(
* Reduces the given nodes to a single spacer * Reduces the given nodes to a single spacer
*/ */
_reduce: function(_nodes) { _reduce: function(_nodes) {
/* if (_nodes.length == 0) if (_nodes.length == 0)
{ {
return; return;
} }
@ -582,7 +582,10 @@ var et2_dataview_partitionOrganizationNode = et2_dataview_partitionNode.extend(
// Create a new spacer node and insert it at the place of the // Create a new spacer node and insert it at the place of the
// first node of the range // first node of the range
ph = new et2_dataview_partitionSpacerNode(this.getRoot(), 0, 0); ph = new et2_dataview_partitionSpacerNode(this.getRoot(), 0, 0);
this.getRoot().insertNodes(_nodes[0].getStartIndex(), [ph]); _nodes[0]._parent.insertNodes(_nodes[0]._pidx, [ph]);
// Initialize the new placeholder
ph.initializeContainer();
} }
// Get the height of the resulting spacer // Get the height of the resulting spacer
@ -596,9 +599,7 @@ var et2_dataview_partitionOrganizationNode = et2_dataview_partitionNode.extend(
} }
// Update the spacer parameters // Update the spacer parameters
et2_debug("log", "Spacer new height, count: ", height, count); ph.setParameters(count, height / count);
ph.setAvgHeight(height / count);
ph.setCount(count);
// Free all elements (except for the spacer) // Free all elements (except for the spacer)
for (var i = _nodes.length - 1; i >= 0; i--) for (var i = _nodes.length - 1; i >= 0; i--)
@ -607,7 +608,7 @@ var et2_dataview_partitionOrganizationNode = et2_dataview_partitionNode.extend(
{ {
_nodes[i].free(); _nodes[i].free();
} }
}*/ }
}, },
/** /**

View File

@ -31,7 +31,9 @@ var et2_dataview_row = et2_dataview_container.extend(et2_dataview_IDataRow, {
setIdx: function(_idx) { setIdx: function(_idx) {
this._idx = _idx; this._idx = _idx;
$j("div:first", this.tr).text(_idx + ":"); $j("div:first", this.tr)
.text(_idx + ":")
.height((_idx % 10) * 10 + 20);
}, },
updateData: function(_data) { updateData: function(_data) {