Browse files

_uiSetWidth needs to account for border width

This unfortunately breaks percentage widths for non-scrolling
tables, since the browser resize is not tracked in core.  The
initial paint should be fine, but resizing the browser won't
resize the table.

I need to move that logic from datatable-scroll to core, but
it'll have to wait for a future sprint :(
  • Loading branch information...
1 parent 490361c commit 06ef0d619dd00775d7c5761bc327aa409047c736 @lsmith committed Feb 28, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 src/datatable/js/core.js
View
11 src/datatable/js/core.js
@@ -1424,12 +1424,15 @@ Y.mix(Table.prototype, {
if (isString(width)) {
this._uiSetDim('width', width);
- // Table width needs to account for borders
- table.setStyle('width',
- (this.get('boundingBox').get('offsetWidth') -
+ if (width) {
+ // Table width needs to account for borders
+ width = (this.get('boundingBox').get('offsetWidth') -
(parseInt(table.getComputedStyle('borderLeftWidth'), 10)|0) -
(parseInt(table.getComputedStyle('borderLeftWidth'), 10)|0)) +
- 'px');
+ 'px';
+ }
+
+ table.setStyle('width', width);
}
},

0 comments on commit 06ef0d6

Please sign in to comment.