我刚刚添加了另一个具有相同设置但没有数据源的表。只需提一下,在 css 样式中,新表的位置是绝对的,并且还添加了一个空的,因为没有这个新表将覆盖滚动条的一部分。CSS:
.tables {
height: inherit;
position: relative;
display: flex;
width: 100%;
}
.table {
overflow: auto;
height: 100%;
width: 100%;
position: relative;
}
.full-width {
width: 100%;
}
.header-table {
position: relative;
width: 100%;
}
.header {
display: flex;
flex-direction: row;
position: absolute;
width: 100%;
}
html code:
<div class="tables">
<md-table
[dataSource]="dataSource"
class="table">
//columns and header definitions.
</md-table>
<div class="header">
<md-table #table
class="header-table">
//the same definition for columns and header.
</md-table>
<div class="scroll-wrapper"></div>//div that covers the scrollbar.
</div>
图片