Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assets/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
}

.@{tablePrefixCls} {
&-expand-icon-th {
width: 18px;
}
&-expand-icon-col {
width: 10px;
}
Expand Down
18 changes: 9 additions & 9 deletions examples/fixedColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ require('rc-table/assets/index.less');
const columns = [
{ title: 'title1', dataIndex: 'a', key: 'a', width: 100, fixed: 'left' },
{ title: 'title2', dataIndex: 'b', key: 'b', width: 100, fixed: 'left' },
{ title: 'title3', dataIndex: 'c', key: 'c' },
{ title: 'title4', dataIndex: 'b', key: 'd' },
{ title: 'title5', dataIndex: 'b', key: 'e' },
{ title: 'title6', dataIndex: 'b', key: 'f' },
{ title: 'title7', dataIndex: 'b', key: 'g' },
{ title: 'title8', dataIndex: 'b', key: 'h' },
{ title: 'title9', dataIndex: 'b', key: 'i' },
{ title: 'title10', dataIndex: 'b', key: 'j' },
{ title: 'title11', dataIndex: 'b', key: 'k' },
{ title: 'title3', dataIndex: 'c', key: 'c', width: 100 },
{ title: 'title4', dataIndex: 'b', key: 'd', width: 100 },
{ title: 'title5', dataIndex: 'b', key: 'e', width: 100 },
{ title: 'title6', dataIndex: 'b', key: 'f', width: 100 },
{ title: <div>title7<br /><br /><br />Hello world!</div>, dataIndex: 'b', key: 'g', width: 100 },
{ title: 'title8', dataIndex: 'b', key: 'h', width: 100 },
{ title: 'title9', dataIndex: 'b', key: 'i', width: 100 },
{ title: 'title10', dataIndex: 'b', key: 'j', width: 100 },
{ title: 'title11', dataIndex: 'b', key: 'k', width: 100 },
{ title: 'title12', dataIndex: 'b', key: 'l', width: 100, fixed: 'right' },
];

Expand Down
15 changes: 9 additions & 6 deletions src/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,15 @@ const Table = React.createClass({

getTable(options = {}) {
const { columns, fixed } = options;
const { prefixCls, scroll = {}, getBodyWrapper } = this.props;
let { useFixedHeader } = this.props;
const { prefixCls, scroll = {}, getBodyWrapper, useFixedHeader } = this.props;
const bodyStyle = { ...this.props.bodyStyle };
const headStyle = {};

let useStandaloneHeader = useFixedHeader;
if (scroll.x || scroll.y) {
useStandaloneHeader = true;
}

let tableClassName = '';
if (scroll.x || columns) {
tableClassName = `${prefixCls}-fixed`;
Expand All @@ -429,7 +433,6 @@ const Table = React.createClass({
bodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y;
}
bodyStyle.overflowY = bodyStyle.overflowY || 'scroll';
useFixedHeader = true;

// Add negative margin bottom for scroll bar overflow bug
const scrollbarWidth = measureScrollbar();
Expand Down Expand Up @@ -464,7 +467,7 @@ const Table = React.createClass({
};

let headTable;
if (useFixedHeader) {
if (useStandaloneHeader) {
headTable = (
<div
className={`${prefixCls}-header`}
Expand All @@ -488,7 +491,7 @@ const Table = React.createClass({
onTouchStart={this.detectScrollTarget}
onScroll={this.handleBodyScroll}
>
{renderTable(!useFixedHeader)}
{renderTable(!useStandaloneHeader)}
</div>
);

Expand All @@ -513,7 +516,7 @@ const Table = React.createClass({
onTouchStart={this.detectScrollTarget}
onScroll={this.handleBodyScroll}
>
{renderTable(!useFixedHeader)}
{renderTable(!useStandaloneHeader)}
</div>
</div>
);
Expand Down