'Restrict adding multiple blank rows in tabulator

I am using tabulator in Angular.I wanted to add new blank row on a button click, so I am adding a new row by using this.table.addRow({}); But every time I click on button, its adding blank row. But I don't want multiple blank rows to be added in Table. Can I prohibit adding blank row if already one blank row is added? How I can find out number of blank rows in table ?



Solution 1:[1]

Tabulator itself has no concept of a "blank row" all, rows are just objects and the table will visualize the data contained in those objects.

But you could use the searchRows function with a custom filter to retrieve the empty rows and check this before triggering the addRow function:

var emptyRowCount = table.searchRows((data) => { return Object.keys(data).length }).length

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Oli Folkerd