From bffdf731cd06cc749f2dc2548a5bee601c5cbffe Mon Sep 17 00:00:00 2001 From: ddcat1115 Date: Tue, 30 Aug 2016 17:01:51 +0800 Subject: [PATCH] fix #2812 (#2875) --- components/table/Table.jsx | 24 ++++-------------------- components/table/style/index.less | 15 +++++++++++++-- package.json | 2 +- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/components/table/Table.jsx b/components/table/Table.jsx index c3c419c00..4649f1eb9 100644 --- a/components/table/Table.jsx +++ b/components/table/Table.jsx @@ -756,8 +756,8 @@ export default class Table extends React.Component { } render() { - const { style, className, rowKey, ...restProps } = this.props; - let data = this.getCurrentPageData(); + const { style, className, ...restProps } = this.props; + const data = this.getCurrentPageData(); let columns = this.renderRowSelection(); const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false; const locale = this.getLocale(); @@ -765,6 +765,7 @@ export default class Table extends React.Component { const classString = classNames({ [`ant-table-${this.props.size}`]: true, 'ant-table-bordered': this.props.bordered, + 'ant-table-empty': !data.length, }); columns = this.renderColumnsDropdown(columns); @@ -774,23 +775,6 @@ export default class Table extends React.Component { return newColumn; }); - // Empty Data - let emptyRowKey; - if (!data || data.length === 0) { - columns.forEach((column, index) => { - column.render = () => ({ - children: !index ?
{locale.emptyText}
: null, - props: { - colSpan: !index ? columns.length : 0, - }, - }); - }); - emptyRowKey = 'key'; - data = [{ - [emptyRowKey]: 'empty', - }]; - } - let table = ( locale.emptyText} /> ); // if there is no pagination or no data, diff --git a/components/table/style/index.less b/components/table/style/index.less index 7085d39d9..65676ce31 100644 --- a/components/table/style/index.less +++ b/components/table/style/index.less @@ -68,6 +68,7 @@ padding: 16px 8px; background: @table-head-background-color; position: relative; + z-index: 2; top: -1px; border-radius: 0 0 @border-radius-base @border-radius-base; } @@ -245,12 +246,19 @@ .@{table-prefix-cls}-fixed-right { border-left: 1px solid @border-color-split; } + .@{table-prefix-cls}-placeholder { + border-bottom: 0; + } } .@{table-prefix-cls}-thead > tr > th { border-bottom: 1px solid @border-color-split; } + &.@{table-prefix-cls}-empty .@{table-prefix-cls}-thead > tr > th { + border-bottom: 0; + } + .@{table-prefix-cls}-tbody tr:last-child { > th, > td { @@ -268,9 +276,12 @@ } &-placeholder { - height: 65px; - line-height: 65px; + padding: 16px 8px; + background: #fff; + border-bottom: 1px solid @border-color-split;; text-align: center; + position: relative; + z-index: 2; font-size: 12px; color: #999; .anticon { diff --git a/package.json b/package.json index 518c5ed4e..d78aea7a1 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "rc-slider": "~4.0.0", "rc-steps": "~2.1.5", "rc-switch": "~1.4.2", - "rc-table": "~4.4.0", + "rc-table": "~4.6.0", "rc-tabs": "~5.9.2", "rc-time-picker": "~1.1.6", "rc-tooltip": "~3.4.2",