Author: konstantin.mishin
Date: 2007-06-18 12:32:29 -0400 (Mon, 18 Jun 2007)
New Revision: 1212
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
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
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
Log:
RF-289
Modified:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-18
15:56:29 UTC (rev 1211)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-06-18
16:32:29 UTC (rev 1212)
@@ -213,6 +213,11 @@
}
ColumnWalker.iterateOverColumns(context, grid, cellRenderer, writer, state);
+ if(!state.isFrozenPart()){
+ writer.startElement("td", grid);
+ getUtils().writeAttribute(writer, "class","ClientUI_Grid_BR");
+ writer.endElement("td");
+ }
writer.endElement(HTML.TR_ELEMENT);
state.nextRow();
state.setCellIndex(0);
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-18
15:56:29 UTC (rev 1211)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Grid.js 2007-06-18
16:32:29 UTC (rev 1212)
@@ -66,21 +66,21 @@
var grid = this;
var layout = new ClientUI.layouts.GridLayoutManager(null, this.getElement());
this.layout = layout;
-
- this.templates.each(function(item) {
+ var header, body, footer;
+ this.templates.unbreakableEach(function(item) {
switch(item.pane) {
case GridLayout_Enum.HEADER: {
- var header = new ClientUI.controls.grid.GridHeader($(item.ref), grid);
+ header = new ClientUI.controls.grid.GridHeader($(item.ref), grid);
layout.addPane(GridLayout_Enum.HEADER, header);
break;
}
case GridLayout_Enum.BODY: {
- var body = new ClientUI.controls.grid.GridBody($(item.ref), grid);
+ body = new ClientUI.controls.grid.GridBody($(item.ref), grid);
layout.addPane(GridLayout_Enum.BODY, body);
break;
}
case GridLayout_Enum.FOOTER: {
- var footer = new ClientUI.controls.grid.GridFooter($(item.ref), grid);
+ footer = new ClientUI.controls.grid.GridFooter($(item.ref), grid);
layout.addPane(GridLayout_Enum.FOOTER, footer);
break;
}
@@ -90,6 +90,9 @@
this.currentScrollPos = 0;
this.controlCreated = true;
this.updateLayout();
+ header.setFakeColumnWidth();
+ body.setFakeColumnWidth();
+ footer.setFakeColumnWidth();
},
updateLayout: function() {
if(!this.controlCreated || this.getHeight()==0) {
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-18
15:56:29 UTC (rev 1211)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-06-18
16:32:29 UTC (rev 1212)
@@ -166,7 +166,9 @@
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")
this.controlCreated = true;
},
parseTemplate: function(templFrozen, templNormal) {
@@ -351,7 +353,19 @@
adjustColumnWidth: function(column, width) {
var columns = this.grid.getHeader().getColumns();
columns[column].bodyCol.width = width;
+ this.setFakeColumnWidth();
},
+
+ setFakeColumnWidth: function() {
+ var columns = this.grid.getHeader().getColumns();
+ columns.last().bodyCol.width = 1;
+ var width = this.grid.getElement().offsetWidth - this.fTable.offsetWidth -
this.nTable.offsetWidth;
+ if (width < 1) {
+ width = 1;
+ }
+ columns.last().bodyCol.width = width;
+ },
+
startLoadData: function() {
if(this.updateStarted) {
this._setPendingTask(this._getPendingTask());
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-18
15:56:29 UTC (rev 1211)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2007-06-18
16:32:29 UTC (rev 1212)
@@ -167,5 +167,16 @@
adjustColumnWidth: function(column, width) {
var columns = this.grid.getHeader().getColumns();
columns[column].footerCol.width = width;
+ this.setFakeColumnWidth();
+ },
+
+ setFakeColumnWidth: function() {
+ var columns = this.grid.getHeader().getColumns();
+ columns.last().footerCol.width = 1;
+ var width = this.grid.getElement().offsetWidth -
this.headerRow.getElement().offsetWidth;
+ if (width < 1) {
+ width = 1;
+ }
+ columns.last().footerCol.width = width;
}
});
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-18
15:56:29 UTC (rev 1211)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-06-18
16:32:29 UTC (rev 1212)
@@ -196,7 +196,6 @@
i++;j++;
});
- columns.pop(); // remove last fake column
this._columns = columns;
this.defaultHeight = defaultHeight;
this.defaultWidth = defaultWidth;
@@ -234,7 +233,8 @@
agjustSeparators: function() {
var offset = 0;
var fcnt = this.headerFrozenRow.getElement().rows[0].cells.length;
- for(var i=0; i<this._columns.length; i++) {
+ var length = this._columns.length - 1;
+ for(var i=0; i<length; i++) {
if(i == fcnt) offset = 0;
offset += this._columns[i].width;
this._columns[i].sep.moveToX(offset - 4);
@@ -414,5 +414,15 @@
this._columns[column].col.width = width;
this._columns[column].width = width;
this.agjustSeparators();
+ this.setFakeColumnWidth();
+ },
+
+ setFakeColumnWidth: function() {
+ this._columns.last().col.width = 1;
+ var width = this.grid.getElement().offsetWidth -
this.headerRow.getElement().offsetWidth;
+ if (width < 1) {
+ width = 1;
+ }
+ this._columns.last().col.width = width;
}
});
Modified:
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-06-18
15:56:29 UTC (rev 1211)
+++
trunk/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid.jspx 2007-06-18
16:32:29 UTC (rev 1212)
@@ -60,7 +60,7 @@
renderCols(context, component, false);
]]>
</jsp:scriptlet>
- <col width="100px" />
+ <col width="1"/>
<tbody>
<tr class="ClientUI_Grid_HR">
<jsp:scriptlet>
@@ -68,7 +68,7 @@
renderHeaders(context, component, false);
]]>
</jsp:scriptlet>
- <td style="width: 100px"></td>
+ <td></td>
</tr>
</tbody>
</table>
@@ -86,7 +86,6 @@
renderCols(context, component, true);
]]>
</jsp:scriptlet>
-
<tbody>
<jsp:scriptlet>
<![CDATA[
@@ -104,7 +103,7 @@
renderCols(context, component, false);
]]>
</jsp:scriptlet>
-
+ <col width="1"/>
<tbody>
<jsp:scriptlet>
<![CDATA[
@@ -127,7 +126,6 @@
renderCols(context, component, true);
]]>
</jsp:scriptlet>
-
<tbody>
<tr class="ClientUI_Grid_FR">
<jsp:scriptlet>
@@ -148,7 +146,7 @@
renderCols(context, component, false);
]]>
</jsp:scriptlet>
-
+ <col width="1"/>
<tbody>
<tr class="ClientUI_Grid_FR">
<jsp:scriptlet>
@@ -156,6 +154,7 @@
renderFooters(context, component,false);
]]>
</jsp:scriptlet>
+ <td></td>
</tr>
</tbody>
</table>