考虑的问题是如何精美的设置,与选项:
- sap.ui.table.Table:滚动固定头。
- sap.m.Table:增长列表,srcollable没有固定标题。
但很多时候,我们需要一个sap.m.Table-滚动的,但与静态头,所以下面的表格内容不低于进一步移动。以下代码将在此期间提供帮助。它有一个固定标题的可滚动身体。
设置:我使用两个sap.m.Table实例,一个只是头和其他仅用于数据。另外,我正在使用一个可滚动的容器,它包含第二个表格(不包含标题)。由于Scrollable容器的固定宽度,我们看到一个滚动条。伪代码下面提供:
view.xml用:
<Table showNoData='false'>
<columns>
<Column>
<header>
<Text text='ID' />
</header>
</Column>
<Column>
<header>
<Text text='First Name' />
</header>
</Column>
<Column>
<header>
<Text text='Last Name' />
</header>
</Column>
<Column>
<header>
<Text text='Gender' />
</header>
</Column>
</columns>
</Table>
<ScrollContainer height='20rem' vertical='true'> <!-- To have fixed with and enable vertical scrolling of data table -->
<!-- Table to hold data, data ,data -->
<Table class='tableHdr' items='{/}'> <!-- CSS class to hide the column header, otherwise we will have 2 headers. -->
<columns>
<!-- Dont need columns header, as upper table has already defined them. -->
<Column >
</Column>
<Column >
</Column>
<Column >
</Column>
<Column >
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text='{id}' />
<Text text='{first_name}' />
<Text text='{last_name}' />
<Text text='{gender}' />
</cells>
</ColumnListItem>
</items>
</Table>
</ScrollContainer>
现在,如果你没有这个执行以下样式类上面的代码,你会从2个表结束了2列标头。所以,要删除第二列标题,我使用了下列类别:
.tableHdr .sapMListTblHeaderCell {
padding: 0rem;
}
想听听对此的反馈。
尝试点击“更多”按钮,它不会加载更多的数据到表? – Jaro
hi @Jaro不,它不会加载整个数据。只有可以在页面 – d33a
上显示的数据可能是基于您的父容器发生的。如果使用'layout:fixContent'作为容器,则表的滚动行为可能会受到影响。 – Andreas