我有一张包含大量数据的表。现在我想在固定表格标题的情况下垂直滚动。我能做到吗?
这是我的代码:
onInit: function() {
var data = new JSONModel("Model/data.json");
this.getView().setModel(data);
var otable = this.getView().byId("PlaceIt");
otable.bindItems("/employees", new ColumnListItem({
cells: [
new Text({
text: "{name}"
}),
new Text({
text: "{Physics}"
}),
new Text({
text: "{Chemistry}"
}),
new Text({
text: "{Maths}"
}),
new Text({
text: "{English}"
})
]
}));
otable.setModel(data);
var oScrollContainer = new ScrollContainer({
height: "100px",
vertical: true,
focusable: true,
content: [oTableItems]
});
},
<Table id="PlaceIt">
<columns>
<Column>
<Text text="Student Name" />
</Column>
<Column>
<Text text="Physics" />
</Column>
<Column>
<Text text="Chemistry" />
</Column>
<Column>
<Text text="Maths" />
</Column>
<Column>
<Text text="English" />
</Column>
</columns>
<!-- ... -->
</Table>
我尝试使用
sap.m.ScrollContainer
控制,但我什么也没得到。这是一个 demo .
最佳答案
As of v1.54 ,属性(property)sticky
是公开的。
sticky
Defines the section of the sap.m.Table control that remains fixed at the top of the page during vertical scrolling as long as the table is in the viewport.
一旦它的值设置为
"ColumnHeaders"
,滚动时标题将保持固定。请注意,此功能仅受现代浏览器支持。
<Table sticky="HeaderToolbar,InfoToolbar,ColumnHeaders">
关于sapui5 - sap.m.Table - 带有固定标题的垂直滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37809148/