diff --git a/examples/js/basic/basic-table.js b/examples/js/basic/basic-table.js index e4f0abce1..779ee1742 100644 --- a/examples/js/basic/basic-table.js +++ b/examples/js/basic/basic-table.js @@ -17,15 +17,15 @@ function addProducts(quantity) { } } -addProducts(5); +addProducts(50); export default class BasicTable extends React.Component { render() { return ( - - Product ID - Product Name - Product Price + + Product ID + Product Name + Product Price ); } diff --git a/src/BootstrapTable.js b/src/BootstrapTable.js index 47e060e58..9a8c92a89 100644 --- a/src/BootstrapTable.js +++ b/src/BootstrapTable.js @@ -1311,39 +1311,7 @@ class BootstrapTable extends Component { const isScroll = tbody.parentNode.getBoundingClientRect().height > tbody.parentNode.parentNode.getBoundingClientRect().height; - const scrollBarWidth = isScroll ? Util.getScrollBarWidth() : 0; - if (firstRow && this.store.getDataNum()) { - if (isScroll || this.isVerticalScroll !== isScroll) { - const cells = firstRow.childNodes; - for (let i = 0; i < cells.length; i++) { - const cell = cells[i]; - const computedStyle = window.getComputedStyle(cell); - let width = parseFloat(computedStyle.width.replace('px', '')); - if (this.isIE) { - const paddingLeftWidth = parseFloat(computedStyle.paddingLeft.replace('px', '')); - const paddingRightWidth = parseFloat(computedStyle.paddingRight.replace('px', '')); - const borderRightWidth = parseFloat(computedStyle.borderRightWidth.replace('px', '')); - const borderLeftWidth = parseFloat(computedStyle.borderLeftWidth.replace('px', '')); - width = width + paddingLeftWidth + paddingRightWidth + borderRightWidth + borderLeftWidth; - } - const lastPadding = (cells.length - 1 === i ? scrollBarWidth : 0); - if (width <= 0) { - width = 120; - cell.width = width + lastPadding + 'px'; - } - const result = width + lastPadding + 'px'; - header[i].style.width = result; - header[i].style.minWidth = result; - if (cells.length - 1 === i) { - bodyHeader[i].style.width = width + 'px'; - bodyHeader[i].style.minWidth = width + 'px'; - } else { - bodyHeader[i].style.width = result; - bodyHeader[i].style.minWidth = result; - } - } - } - } else { + if (!(firstRow && this.store.getDataNum())) { for (const i in bodyHeader) { if (bodyHeader.hasOwnProperty(i)) { const child = bodyHeader[i];