Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
860 views
in Technique[技术] by (71.8m points)

pagination - 我们可以在不使用MatTableDataSource /的情况下在Angular中使用MatPaginator吗? <mat-table> ?(Can we use MatPaginator in Angular without using the MatTableDataSource/<mat-table>?)

I am trying to use MatPaginator but with a normal 'table' tag in html instead of 'mat-table'.

(我正在尝试使用MatPaginator,但在html中使用普通的“ table”标记,而不是“ mat-table”。)

It didnt seem to work and when I looked up for some references, I found all the examples related to MatPaginator makes use of the MatTableDataSource.

(它似乎没有用,当我查找一些参考资料时,我发现所有与MatPaginator相关的示例都使用了MatTableDataSource。)

Is it compulsory that both should be clubbed and used for the pagination to work?

(是否必须将两者合并在一起并用于分页工作?)

  ask by Malini Srilekha translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

MatTableDataSource is aimed to be used for filtering, sorting and pagination of a client-side data array.

(MatTableDataSource旨在用于客户端数据数组的过滤,排序和分页。)

In cases where filtering, sorting and pagination are done server-side, the use of this class is not appropriate.

(如果在服务器端进行了筛选,排序和分页,则不适合使用此类。)

A good example is given at https://blog.angular-university.io/angular-material-data-table/ .

(https://blog.angular-university.io/angular-material-data-table/提供了一个很好的示例。)

It doesn't use MatTableDataSource but still uses mat-table , this should however be easily adaptable to a normal HTML table .

(它不使用MatTableDataSource但仍使用mat-table ,但是应该可以轻松地适应普通的HTML table 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...