Author: konstantin.mishin
Date: 2009-11-17 10:28:13 -0500 (Tue, 17 Nov 2009)
New Revision: 15892
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.css
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
Log:
RF-7865
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-11-17
15:28:12 UTC (rev 15891)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-11-17
15:28:13 UTC (rev 15892)
@@ -35,6 +35,9 @@
import org.richfaces.component.util.HtmlUtil;
@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "extendedDataTable.js"),
@ResourceDependency(name = "extendedDataTable.css")
})
@@ -207,7 +210,7 @@
if (column.isRendered()) {
writer.startElement(HTML.TD_ELEM, table);
writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-std2-cell
rich-std2-cell-width-" + columnIndex++, null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-cell
rich-extable-cell-width-" + columnIndex++, null);
renderChildren(context, column);
writer.endElement(HTML.DIV_ELEM);
writer.endElement(HTML.TD_ELEM);
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.css
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.css 2009-11-17
15:28:12 UTC (rev 15891)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.css 2009-11-17
15:28:13 UTC (rev 15892)
@@ -22,6 +22,7 @@
.rich-extable{
background-color: #FFFFFF;
border: 1px solid #C4C0C9;
+ height: 100%;
}
.rich-extable-header {
@@ -47,10 +48,10 @@
overflow: hidden;
}
-/*.rich-extable-footer-part{
+.rich-extable-footer-part{
overflow-x: auto;
overflow-y: visible;
-}*/
+}
.rich-extable-cell, .rich-extable-header-cell, .rich-extable-footer-cell{
height: 20px;
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2009-11-17
15:28:12 UTC (rev 15891)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2009-11-17
15:28:13 UTC (rev 15892)
@@ -20,6 +20,20 @@
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
(function(richfaces, jQuery) {
+ richfaces.getCSSRule = function (className) {
+ var rule = null;
+ var sheets = document.styleSheets;
+ for (var j = 0; !rule && j < sheets.length; j++) {
+ var rules = sheets[j].cssRules ? sheets[j].cssRules: sheets[j].rules;
+ for (var i = 0; !rule && i < rules.length; i++) {
+ if (rules[i].selectorText.toLowerCase() == (className.toLowerCase())) {
+ rule = rules[i];
+ }
+ }
+ }
+ return rule;
+ };
+
richfaces.ExtendedDataTable = function(id) {
this.id = id;
this.element = document.getElementById(id);
@@ -29,26 +43,32 @@
this.dataTableElement = this.contentElement.lastChild;//TODO this.dataTableElement =
Richfaces.lastDescendant(this.contentElement);
this.frozenHeaderPartElement = document.getElementById(id + ":fhpe");
- this.normalPartStyle = Utils.getRule(".rich-std2-part-width").style;
- this.resizerHolderStyle = Utils.getRule(".rich-std2-resizer-holder").style;
+ this.normalPartStyle =
richfaces.getCSSRule(".rich-extable-part-width").style;
this.idSuffixs = [":nhpe", ":nbpe", ":nfpe"];
this.scrollElement = document.getElementById(this.id + this.idSuffixs[2]);
this.rows = document.getElementById(id + ":nbte").rows.length;
- this.scrollListener = this.updateScrollPosition.bindAsEventListener(this);
- Event.observe(this.scrollElement, 'scroll', this.scrollListener);
- this.updateDataListener = this.updateData.bindAsEventListener(this);
- Event.observe(this.bodyElement, 'scroll', this.updateDataListener);
- this.resizeListener = this.updateLayout.bindAsEventListener(this);
- Event.observe(window, 'resize', this.resizeListener);
-
+ this.updateLayout = function() {
+ var offsetWidth = this.frozenHeaderPartElement ?
this.frozenHeaderPartElement.offsetWidth : 0;
+ this.normalPartStyle.width = this.element.clientWidth - offsetWidth + "px";
+ var height = this.element.clientHeight;
+ var element = this.element.firstChild;
+ while (element) {
+ if(element.nodeName.toUpperCase() == "DIV" && element !=
this.bodyElement) {
+ height -= element.offsetHeight;
+ }
+ element = element.nextSibling;
+ }
+ this.bodyElement.style.height = height + "px";
+ };
+
var table = this;
jQuery(document).ready(function(){
- table.contentElement.style.height = (table.rowCount *
table.dataTableElement.offsetHeight / table.rows) + "px";
- table.updateLayout();
- });
+ table.contentElement.style.height = (table.rowCount *
table.dataTableElement.offsetHeight / table.rows) + "px";
+ table.updateLayout();
+ });
};
}(window.RichFaces, jQuery));