‘宽度支持百分比计算,含有固定列的表格渲染expand问题’

This commit is contained in:
wanghaoo 2018-09-18 10:35:32 +08:00
parent 4b6dd9bd1c
commit 2777f07372
8 changed files with 56 additions and 13 deletions

View File

@ -32,6 +32,30 @@ const columns16 = [
{ id: "123", title: "性别", dataIndex: "b", key: "b", width: 100 }, { id: "123", title: "性别", dataIndex: "b", key: "b", width: 100 },
{ title: "年龄", dataIndex: "c", key: "c", width: 200 }, { title: "年龄", dataIndex: "c", key: "c", width: 200 },
];
const columns17 = [
{
title: "操作",
dataIndex: "d",
key: "d",
width:200,
render(text, record, index) {
return (
<a
href="#"
onClick={() => {
alert("这是第" + index + "列,内容为:" + text);
}}
>
一些操作
</a>
);
}
},
{ title: "用户名", dataIndex: "a", key: "a", width: 100 },
{ id: "123", title: "性别", dataIndex: "b", key: "b", width: 100 },
{ title: "年龄", dataIndex: "c", key: "c", width: 200 },
]; ];
const data16 = [ const data16 = [
@ -49,14 +73,13 @@ class Demo16 extends Component {
} }
} }
expandedRowRender = (record, index, indent) => { expandedRowRender = (record, index, indent) => {
console.log(this.state.data_obj[record.key].length); let height = 42 * (this.state.data_obj[record.key].length+ 2);
let height = 42 * (this.state.data_obj[record.key].length+ 3);
return ( return (
<Table <Table
columns={columns16} columns={columns17}
style={{height:height}} style={{height:height}}
data={this.state.data_obj[record.key]} data={this.state.data_obj[record.key]}
/> />
); );

File diff suppressed because one or more lines are too long

2
dist/demo.css vendored
View File

@ -8496,6 +8496,8 @@ ul {
background: #f7f7f7; } background: #f7f7f7; }
.u-table tr.u-table-expanded-row:hover { .u-table tr.u-table-expanded-row:hover {
background: #f7f7f7; } background: #f7f7f7; }
.u-table tr.u-table-expanded-row .u-table {
z-index: 1; }
.u-table-column-hidden { .u-table-column-hidden {
display: none; } display: none; }
.u-table-prev-columns-page, .u-table-next-columns-page { .u-table-prev-columns-page, .u-table-next-columns-page {

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

27
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -356,7 +356,7 @@ class Table extends Component{
props: { props: {
colSpan: colCount, colSpan: colCount,
}, },
children: fixed !== 'right' ? content : contentContainer(), children: !fixed ? content : contentContainer(),
}), }),
}]; }];
if (expandIconAsCell && fixed !== 'right') { if (expandIconAsCell && fixed !== 'right') {

View File

@ -192,6 +192,7 @@ $table-move-in-color: $bg-color-base;
} }
.u-table { .u-table {
// padding: 0 40px 0 20px; // padding: 0 40px 0 20px;
z-index: 1;
} }
} }
&-column-hidden { &-column-hidden {