Angular 6 从材料表中获取排序数据 [英] Angular 6 Get sorted data from Material Table

查看:22
本文介绍了Angular 6 从材料表中获取排序数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以在对材料表应用排序后从材料表中获取排序数据?我可以在表数据源中看到filteredData",但没有sortedData".我想要排序数据的原因是我可以将它导出到 csv 文件中,同时保持所有应用的排序.我一直在使用内置的 MatSort 对表格中的各个列进行排序.

Is there any way to get the sorted data from a material table after sorts on the table have been applied? I can see "filteredData" in the table datasource but there's no "sortedData". The reason why I want the sorted data is so that I can export it in a csv file while maintaining all of the sorts applied. I've been using the built in MatSort to sort individual columns in the table.

推荐答案

有一种数据排序方法,可以与 datasource.data 或 datasource.filteredData 一起使用

There is a sort data method, that you can use with either datasource.data or datasource.filteredData

    dataSource.sortData(dataSource.filteredData,dataSource.sort);

这篇关于Angular 6 从材料表中获取排序数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆