简体   繁体   中英

Set minimum row in PrimeNG p-table

I use PrimeNG (version 7.0.4) p-table and besides configuring row numbers via [rows] parameter in HTML, I want to set minimum rows for p-table.

For example, I set [rows]=10 and there are only 5 records at the last page. I want to display 10 rows even if there is only one record in the p-table . I look at How to set minimum value of rows primeNG datatable , but I am wondering if there is a configuration for that.

This approach works like a charm:

if (this.records.length < 10) {
    let temp = { "Id": '', "Name": '', "Surname": '', "Age": '' };
    for (let i = this.records.length; i < 10; i++) {
        this.records.push(temp);
    }
}

Thanks @Antikhippe :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM