Author: pkawiak
Date: 2008-06-25 07:47:54 -0400 (Wed, 25 Jun 2008)
New Revision: 9214
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js
Log:
Hotfixes for Opera
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js 2008-06-25
10:23:56 UTC (rev 9213)
+++
trunk/sandbox/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js 2008-06-25
11:47:54 UTC (rev 9214)
@@ -20,7 +20,6 @@
}
this.eventContainerResize = this.OnWindowResize.bindAsEventListener(this);
this.eventGroupRowClicked = this.OnGroupRowMouseClicked.bindAsEventListener(this);
- ClientUILib.log(ClientUILogger.INFO, "[observe] resize");
Event.observe(window, "resize", this.eventContainerResize);
this.minColumnWidth = this.options.minColumnWidth;
@@ -55,13 +54,9 @@
},
OnCellMouseClicked: function(event) {
- ClientUILib.log(ClientUILogger.EVENT, "OnCellMouseClicked");
- //this.showSplashScreen();
//get column id
var el = this._findParentElement(event, "th");
var columnId = (el) ? el.id : null;
-
- ClientUILib.log(ClientUILogger.INFO, "columnId: " + columnId);
if (columnId && (columnId != "")){
this.showSplashScreen();
@@ -71,7 +66,6 @@
},
preSendAjaxRequest: function(){
- ClientUILib.log(ClientUILogger.INFO, "preSendAjaxReqest");
//remove listeners
Event.stopObserving(window, 'resize', this.eventContainerResize);
Event.stopObserving(document, 'mousemove', this.header.eventSepMouseMove);
@@ -81,19 +75,24 @@
},
showSplashScreen: function(){
- this.table.setStyle('visibility:hidden;');
- this.mainDiv.getElement().removeClassName('extdt-splscr-hddn');
- this.mainDiv.getElement().addClassName('extdt-splscr-vsbl');
+ if (ClientUILib.isOpera) {
+ this.mainDiv.setStyle({display:'none'});
+ }
+ this.table.setStyle({visibility:'hidden'});
+ this.mainDiv.getElement().removeClassName('extdt-splscr-hddn');
+ this.mainDiv.getElement().addClassName('extdt-splscr-vsbl');
},
hideSplashScreen: function(){
- this.table.setStyle('visibility:visible;');
+ if (ClientUILib.isOpera) {
+ this.mainDiv.setStyle({display:''});
+ }
+ this.table.setStyle({visibility:'visible'});
this.mainDiv.getElement().removeClassName('extdt-splscr-vsbl');
this.mainDiv.getElement().addClassName('extdt-splscr-hddn');
},
OnWindowResize: function(event) {
- ClientUILib.log(ClientUILogger.EVENT, "OnWindowResize.");
this.updateLayout();
},
getColumnsNumber: function() {
@@ -107,7 +106,6 @@
},
OnGroupRowMouseClicked: function(event) {
- ClientUILib.log(ClientUILogger.EVENT, "OnGroupRowMouseClicked.");
var groupRow = this._findParentElement(event, "tr");
var bExpanded = !(groupRow.getAttribute('expanded') == 'true');
var sExpanded = bExpanded ? 'true' : 'false';
@@ -129,6 +127,20 @@
imageDiv.setAttribute('alternatesrc', src);
},
+ getColumnWidth: function(columnNumber) {
+ if ((columnNumber < this.getColumnsNumber()) && (columnNumber >=0))
{
+ var col = this.getColumns()[columnNumber+this.getColumnsNumber()];
+ if (col.offsetWidth) {
+ return col.offsetWidth;
+ }else{
+ //cols don't have offsetWidth in Opera
+ return parseInt(col.width);
+ }
+ }else{
+ return null;
+ }
+ },
+
setGroupExpanded: function(iGroupIndex, bValue) {
var group = this.groups[iGroupIndex];
@@ -228,59 +240,43 @@
if (footers.size() > 0) {
footerHeight = footers[0].offsetHeight;
}
- ClientUILib.log(ClientUILogger.INFO,
- "[updateLayout] footerHeight = "+
- footerHeight+";"
- );
- ClientUILib.log(ClientUILogger.INFO,
- "[updateLayout] mainDivHeight = "+
- mainDivHeight+";"
- );
var columnsNumber = this.getColumnsNumber();
var visibleHeaderWidth = this.header.getVisibleWidth();
var excessWidth = this.header.getVisibleWidth() - this.mainDiv.getWidth();
- ClientUILib.log(ClientUILogger.INFO,
- "[updateLayout] getVisibleHeaderWidth() = "+
- visibleHeaderWidth+";"
- );
- ClientUILib.log(ClientUILogger.INFO,
- "[updateLayout] mainDiv.getWidth() = "+
- this.mainDiv.getWidth()+";"
- );
- ClientUILib.log(ClientUILogger.INFO,
- "[updateLayout] excessWidth1 = "+
- excessWidth+";"
- );
if (excessWidth > 0) {
var scrollbarExcess = scrollingDiv.getElement().offsetWidth -
scrollingDiv.getElement().clientWidth;
excessWidth += scrollbarExcess;
this.validateColumnsWidth(cols,excessWidth);
}else{
var excessWidth = visibleHeaderWidth - scrollingDiv.getElement().clientWidth;
- ClientUILib.log(ClientUILogger.INFO,
- "[updateLayout] excessWidth2 = "+
- excessWidth+";"
- );
if (excessWidth>0) {
this.validateColumnsWidth(cols,excessWidth);
}
}
- ClientUILib.log(ClientUILogger.INFO,
- "scrollbarWidth = "+
- this.getScrollbarWidth()+";"
- );
if (ClientUILib.isOpera) {
- var newWidth = mainDivWidth - visibleHeaderWidth;
- cols[columnsNumber-1].width = newWidth;
- cols[cols.length-1].width = newWidth - this.getScrollbarWidth();
+ var _stl = headerChildren[0].getStyles().borderRightWidth;
+ _stl = parseInt(_stl.replace(/"px"/,""))*2;
+ var newWidth = mainDivWidth - visibleHeaderWidth -
(this.header.getColumnsNumber()-1)*_stl;
+ cols[columnsNumber-1].width = newWidth;
+ ClientUILib.log(ClientUILogger.INFO, "_stl: " + _stl);
+ ClientUILib.log(ClientUILogger.INFO, "newWidth: " + newWidth);
+ newWidth -= this.getScrollbarWidth()-1;
+ if (newWidth <= 0) {
+ newWidth = 1;
+ }
+ cols[cols.length-1].width = newWidth;
+ ClientUILib.log(ClientUILogger.EVENT, "newWidth: " + newWidth);
+ var cols = this.header.getColumns();
+ var columnsNumber = this.header.getColumnsNumber();
+ for (var i=0; i<columnsNumber-1; i++) {
+ cols[i].width = parseInt(cols[i+columnsNumber].width) - _stl;
+ }
}else{
cols[columnsNumber-1].width = null;
cols[cols.length-1].width = null;
}
-
scrollingDiv.setStyle('height:'+(mainDivHeight - header.getHeight() -
footerHeight - 2) +'px;');
-
for (var i=0; i<headerChildren.length-1; i++) {
var headerChild = headerChildren[i];
var isSortable = headerChild.getAttribute('sortable');