gpt4 book ai didi

sapui5 - sap.m.Table - 带有固定标题的垂直滚动

转载 作者:行者123 更新时间:2023-12-02 11:24:59 34 4
gpt4 key购买 nike

我有一张包含大量数据的表。现在我想在固定表格标题的情况下垂直滚动。我能做到吗?

这是我的代码:

 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" ,滚动时标题将保持固定。

sapui5 openui5 ui5 sap.m.Table sticky fixed column headers

请注意,此功能仅受现代浏览器支持。


  • 演示: https://jsbin.com/ticivew/edit?js,output
  • Property description
  • Other sticky options v1.56 - 在 XMLView 中分配多个值的语法如下所示:

    <Table sticky="HeaderToolbar,InfoToolbar,ColumnHeaders">
  • 关于sapui5 - sap.m.Table - 带有固定标题的垂直滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37809148/

    34 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com