Author: dmorozov
Date: 2007-06-14 08:28:39 -0400 (Thu, 14 Jun 2007)
New Revision: 1180
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
Log:
Add capability for grid to load and initialize within hidden parent.
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-06-14
11:39:44 UTC (rev 1179)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-06-14
12:28:39 UTC (rev 1180)
@@ -122,10 +122,17 @@
document.gridEndTime = (new Date()).getTime();
},
updateLayout: function() {
- if(!this.controlCreated) {
+ if(!this.controlCreated || this.getHeight()==0) {
return;
}
ClientUI.controls.grid.Grid.parentClass.method("updateLayout").call(this);
+
+ var header = this.getHeader();
+ if(header.getHeight() == 0) {
+ header.updateSize();
+ this.getBody().updateSize();
+ if(this.getFooter()) {this.getFooter().updateSize();}
+ }
if(this.layout) {
this.layout.updateLayout();
}
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14
11:39:44 UTC (rev 1179)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-14
12:28:39 UTC (rev 1180)
@@ -216,6 +216,12 @@
this.frozenContentBox.getElement().scrollTop = pos;
}
},
+ updateSize: function() {
+ this.defaultRowHeight =
Element.getHeight(this.templNormal.getElement().rows[0].cells[0]);
+ if(ClientUILib.isGecko) {
+ this.defaultRowHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
+ }
+ },
updateLayout: function() {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-06-14
11:39:44 UTC (rev 1179)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-06-14
12:28:39 UTC (rev 1180)
@@ -127,6 +127,16 @@
}
return true;
},
+ updateSize: function() {
+ this.defaultWidth = this.grid.getHeader().defaultWidth;
+ this.defaultHeight = Element.getHeight(this.headerRow.getElement().rows[0].cells[0]);
+ if(ClientUILib.isGecko) {
+ this.defaultHeight -= this.getBorderWidth("tb") +
this.getPadding("tb");
+ //this.defaultWidth -= this.getBorderWidth("lr") +
this.getPadding("lr");
+ }
+ this.setHeight(this.defaultHeight);
+ this.setWidth(this.defaultWidth);
+ },
updateLayout: function() {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-14
11:39:44 UTC (rev 1179)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-14
12:28:39 UTC (rev 1180)
@@ -63,8 +63,6 @@
this.setWidth(this.defaultWidth);
this.controlCreated = true;
this.updateLayout();
- this.hide();
- this.show();
},
parseTemplate: function(template) {
if(!template) {
@@ -242,6 +240,43 @@
this._columns[i].sep.moveToX(offset - 4);
}
},
+ updateSize: function() {
+ var defaultWidth = 0, defaultHeight = 0;
+ var i = 0, h, j=0;
+ var columns = this._columns;
+ var cols =
$A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
+ var cells = $A(this.headerFrozenRow.getElement().rows[0].cells);
+ cells.each(function(cell) {
+ if(i<columns.length) {
+ columns[i].width = parseInt(cols[j].width);
+ h = Element.getHeight(cell);
+ if(h > defaultHeight) defaultHeight = h;
+ defaultWidth += columns[i].width;
+ }
+ i++;j++;
+ });
+
+ j=0;
+ cols = $A(this.headerRow.getElement().getElementsByTagName("col"));
+ cells = $A(this.headerRow.getElement().rows[0].cells);
+ cells.each(function(cell) {
+ if(i<columns.length) {
+ columns[i].width = parseInt(cols[j].width);
+
+ h = Element.getHeight(cell);
+ if(h > defaultHeight) defaultHeight = h;
+ defaultWidth += columns[i].width;
+ }
+ i++;j++;
+ });
+
+ this.defaultHeight = defaultHeight;
+ this.defaultWidth = defaultWidth;
+
+ this.setHeight(this.defaultHeight);
+ this.setWidth(this.defaultWidth);
+ this.agjustSeparators();
+ },
updateLayout: function() {
if(!this.controlCreated || !this.grid.controlCreated) {
return;
Show replies by date