Author: konstantin.mishin
Date: 2009-12-30 13:06:28 -0500 (Wed, 30 Dec 2009)
New Revision: 16231
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.js
Log:
RF-7868
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-12-29
21:52:25 UTC (rev 16230)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-12-30
18:06:28 UTC (rev 16231)
@@ -138,6 +138,10 @@
writer.writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(context) +
":d", null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-extable-drag",
null);
writer.endElement(HTML.DIV_ELEM);
+ writer.startElement(HTML.INPUT_ELEM, component);
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(context) +
":wi", null);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
+ writer.endElement(HTML.INPUT_ELEM);
writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
writer.write("new RichFaces.ExtendedDataTable('" +
component.getClientId(context) + "');");
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-12-29
21:52:25 UTC (rev 16230)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2009-12-30
18:06:28 UTC (rev 16231)
@@ -45,6 +45,7 @@
var dataTableElement = contentElement.lastChild;//TODO this.dataTableElement =
Richfaces.lastDescendant(this.contentElement);
var frozenHeaderPartElement = document.getElementById(id + ":frozenHeader");
var dragElement = document.getElementById(id + ":d");
+ var widthInput = document.getElementById(id + ":wi");
var normalPartStyle =
richfaces.getCSSRule(".rich-extable-part-width").style;
var resizerHolders =
jQuery(element).children(".rich-extable-header").find(".rich-extable-resizer-holder").get();
@@ -57,6 +58,7 @@
var scrollElement = document.getElementById(id + idSuffixs[2]);
var resizeData = {};
+ var newWidths = {};
var updateLayout = function() {
var offsetWidth = frozenHeaderPartElement ? frozenHeaderPartElement.offsetWidth : 0;
@@ -74,7 +76,7 @@
var height = element.clientHeight;
var el = element.firstChild;
while (el) {
- if(el.nodeName.toUpperCase() == "DIV" && el != bodyElement) {
+ if(el.nodeName && el.nodeName.toUpperCase() == "DIV" && el
!= bodyElement) {
height -= el.offsetHeight;
}
el = el.nextSibling;
@@ -134,18 +136,19 @@
};
var drag = function(event) {
- dragElement.style.left = Math.max(resizeData.left + MIN_WIDTH, event.clientX);
+ dragElement.style.left = (Math.max(resizeData.left + MIN_WIDTH, event.pageX) -
jQuery(dragElement).offsetParent().offset().left) + "px";
return false;
};
var beginResize = function(event) {
var parts = this.id.split(":");
+ var thisElement = jQuery(this);
resizeData = {
id : parts[parts.length - 2],
- left : jQuery(this.parentNode).offset().left
+ left : thisElement.parent().offset().left
};
- dragElement.style.top = jQuery(this).offset().top;
- dragElement.style.left = event.clientX;
- dragElement.style.height = element.clientHeight;
+ dragElement.style.height = element.clientHeight + "px";
+ dragElement.style.top = thisElement.offset().top -
thisElement.offsetParent().offset().top + "px";
+ dragElement.style.left = (event.pageX - jQuery(element).offsetParent().offset().left)
+ "px";
dragElement.style.display = "block";
jQuery(document).bind("mousemove", drag);
jQuery(document).one("mouseup", endResize);
@@ -155,7 +158,14 @@
var endResize = function(event) {
jQuery(document).unbind("mousemove", drag);
dragElement.style.display = "none";
- richfaces.getCSSRule(WIDTH_CLASS_NAME_BASE + resizeData.id).style.width =
Math.max(MIN_WIDTH, event.clientX - resizeData.left) + "px";
+ var width = Math.max(MIN_WIDTH, event.pageX - resizeData.left) + "px";
+ richfaces.getCSSRule(WIDTH_CLASS_NAME_BASE + resizeData.id).style.width = width;
+ newWidths[resizeData.id] = width;
+ var widthsArray = new Array();
+ for (var id in newWidths) {
+ widthsArray.push(id + ":" + newWidths[id]);
+ }
+ widthInput.value = widthsArray.toString();
updateLayout();
adjustResizers();
};
Show replies by date