我刚刚添加了具有相同设置和无数据源的另一个表。 只是提到,在新表格的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代码:
<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>
image