角材料表设置默认行数 [英] Angular Material Table set default number of rows

查看:49
本文介绍了角材料表设置默认行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在页面加载时在表格上设置行数,而该行尚无数据.如果单击要显示数据列表的按钮,它将填充我设置的n个数字的行.

I want to set a number of rows on the table on page load having no data yet. If I click a button for me to display the list of data it will then populate the rows for n number I set.

我已经尝试过在默认行上添加默认长度.

I already tried adding a default length on the matrow.

假设ngOnInit()将显示8行,当我单击按钮以显示数据时,它将填充我设置的8行,并且仍然使用 mat-paginator 进行分页.

Let say ngOnInit() it will display 8 rows and when I click a button to display the data, it would fill up the 8 rows I set and there's still a pagination using mat-paginator.

这可能吗?

推荐答案

根据初始行数填充空白数据,然后在单击按钮时加载实际数据.

Populate using empty data according to the number of initial rows, then load real data when the button is clicked.

Stackblitz: https://stackblitz.com/edit/angular-f3g5vu?file=app%2Ftable-pagination-example.ts

Stackblitz: https://stackblitz.com/edit/angular-f3g5vu?file=app%2Ftable-pagination-example.ts

这篇关于角材料表设置默认行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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