power apps已经将Datatable中items属性设置为filtereddata
时间: 2024-04-03 22:36:12 浏览: 25
好的,既然您已经将DataTable的items属性设置为filteredData,那么我们只需要在上一页和下一页按钮的OnSelect属性中修改filteredData中每行的PageNumber属性即可。
以下是代码示例:
// 初始化变量
Set(currentPage, 1);
Set(totalPages, RoundUp(CountRows(filteredData) / 5, 0));
// 上一页按钮
OnSelect:
Set(currentPage, currentPage - 1);
If(currentPage < 1, Set(currentPage, 1));
ForAll(filteredData, Patch(filteredData, ThisRecord, {PageNumber: Floor(RowNumber(filteredData) / 5) + 1}));
Navigate(ThisScreen)
// 下一页按钮
OnSelect:
Set(currentPage, currentPage + 1);
If(currentPage > totalPages, Set(currentPage, totalPages));
ForAll(filteredData, Patch(filteredData, ThisRecord, {PageNumber: Floor(RowNumber(filteredData) / 5) + 1}));
Navigate(ThisScreen)
// DataTable控件
Items: Filter(filteredData, PageNumber = currentPage)
在这个示例中,我们使用了Patch函数来修改filteredData中每行的PageNumber属性。同时,我们还使用了ThisRecord和RowNumber函数来获取当前行的索引。
希望这次回答能够解决您的问题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)