Skip to content

Commit fc8c5e6

Browse files
committed
Bugfix: Allow estimating width for really really wide tables
1 parent b81ca9d commit fc8c5e6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,7 @@ DGTable.prototype._calculateTbodyWidth = function () {
927927
column;
928928

929929
var $row = $('<div>').addClass(rowClassName).css('float', 'left');
930+
var sumActualWidth = 0;
930931

931932
for (colIndex = 0; colIndex < colCount; colIndex++) {
932933
column = visibleColumns[colIndex];
@@ -936,14 +937,15 @@ DGTable.prototype._calculateTbodyWidth = function () {
936937
if (column.cellClasses) cell.className += ' ' + column.cellClasses;
937938
cellInner = cell.appendChild(createElement('div'));
938939
$row.append(cell);
940+
sumActualWidth += column.actualWidth;
939941
}
940942

941943
var $thisWrapper = $('<div>')
942944
.addClass(that.el.className)
943945
.css({ 'z-index': -1, 'position': 'absolute', left: '0', top: '-9999px', 'float': 'left', width: '1px', overflow: 'hidden' })
944946
.append(
945947
$('<div>').addClass(tableClassName).append(
946-
$('<div>').addClass(tableClassName + '-body').css('width', 99999).append(
948+
$('<div>').addClass(tableClassName + '-body').css('width', sumActualWidth + 10000).append(
947949
$row
948950
)
949951
)

0 commit comments

Comments
 (0)