Power app中DataTable没有VisibleRows的属性
时间: 2024-03-21 12:40:57 浏览: 83
很抱歉我的回答有误,确实 PowerApps 的 DataTable 控件没有 VisibleRows 属性。如果需要分页功能,您可以考虑使用 Gallery 控件实现。以下是使用 Gallery 控件实现分页的步骤:
1.在 PowerApps 中创建一个新的屏幕,然后添加一个 Gallery 控件。
2.将 Gallery 的 Items 属性设置为筛选后的数据源 filteredData。
3.将 Gallery 的 Layout 属性设置为 Title, subtitle, and body。
4.为 Gallery 添加两个按钮,一个用于上一页,一个用于下一页,并为它们分别设置 OnSelect 属性。
5.为上一页按钮的 OnSelect 属性添加以下公式:
```
If(Value(PageNumber.Text)>1,UpdateContext({currentPage:Value(PageNumber.Text)-1}))
```
6.为下一页按钮的 OnSelect 属性添加以下公式:
```
If(Value(PageNumber.Text)<Ceiling(CountRows(filteredData)/5),UpdateContext({currentPage:Value(PageNumber.Text)+1}))
```
这里的 Ceiling 函数用于向上取整,CountRows 函数用于获取 filteredData 中的行数,然后除以 5 得到总页数。
7.在 Gallery 的 Items 属性中添加以下公式,用于根据当前页码和每页显示的行数来计算应该显示哪些行:
```
Table.Skip(Table.FirstN(filteredData,(currentPage-1)*5),Mod((currentPage-1)*5,CountRows(filteredData)))
```
这里的 Table.FirstN 函数用于获取 filteredData 的前 n 行数据,Table.Skip 函数用于跳过前 n 行数据,Mod 函数用于获取余数,用于计算最后一页应该显示的行数。
8.在屏幕上添加一个文本框,用于显示当前页码,将其默认值设置为 1。
9.在文本框的 Text 属性中添加以下公式,用于显示当前页码:
```
Text(currentPage)
```
完成以上步骤后,您可以尝试在应用程序中运行该屏幕,并使用上下页按钮来分页显示 Gallery 中的数据。
阅读全文
相关推荐














