Browse Source

update table loading

pull/460/head
afc163 9 years ago
parent
commit
e0c9da599a
  1. 39
      components/table/index.jsx

39
components/table/index.jsx

@ -589,34 +589,27 @@ let AntTable = React.createClass({
</div>; </div>;
emptyClass = ' ant-table-empty'; emptyClass = ' ant-table-empty';
} }
// spin holder
let spinEl; const table = (
let spinWrapperClass = ''; <div className={'clearfix' + emptyClass}>
<Table {...this.props}
data={data}
columns={columns}
className={classString}
expandIconAsCell={expandIconAsCell} />
{emptyText}
{this.renderPagination()}
</div>
);
if (this.state.loading && !this.isLocalDataSource()) { if (this.state.loading && !this.isLocalDataSource()) {
// if there is no pagination or no data, the height of spin should decrease by half of pagination // if there is no pagination or no data, the height of spin should decrease by half of pagination
let paginationPatchClass = (this.hasPagination() && data && data.length !== 0) let paginationPatchClass = (this.hasPagination() && data && data.length !== 0)
? 'ant-table-with-pagination' ? 'ant-table-with-pagination'
: 'ant-table-without-pagination'; : 'ant-table-without-pagination';
let spinClass = `${paginationPatchClass} ant-table-spin-holder`; let spinClassName = `${paginationPatchClass} ant-table-spin-holder`;
return <Spin className={spinClassName}>{table}</Spin>;
spinEl = <div className={spinClass}> }
<Spin /> return table;
</div>;
spinWrapperClass = ' ant-table-loading';
}
return <div className={'clearfix' + emptyClass + spinWrapperClass}>
<Table
{...this.props}
data={data}
columns={columns}
className={classString}
expandIconAsCell={expandIconAsCell}
/>
{emptyText}
{spinEl}
{this.renderPagination()}
</div>;
} }
}); });

Loading…
Cancel
Save