Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

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.

Is this possible?

See Question&Answers more detail:os

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

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...