Open jfrseeley opened 4 years ago
FYI, this hack serves as a workaround:
const hadNoRows = this.dataSource.filteredData.length === 0;
this.dataSource.filter = filter.trim().toLowerCase();
const hasRows = this.dataSource.filteredData.length > 0;
if (hadNoRows && hasRows) {
this.loadMoreBtn._loadNextPage();
}
I've also found this bug applies if the table component's paginator field is set before loading any rows. Thus, it isn't exclusive to trying to combine filters and paginators. The paginator just doesn't seem to know how to respond when the table is moving from an empty row set to a non-empty row set.
When filtering on a table component with a paginator, those filters resulting in no rows cause future filters to also result in no rows.
Steps to reproduce:
LoadMorePaginationComponent
) to the data source.Workaround: Use the paginator to load more.
Stackblitz: https://stackblitz.com/edit/angular-ysxljy
Note: Stackblitz link is a fork of the Pagination Load More example, combined with snippets from the Table Filter example