While working on a table project using Angular Material, I encountered an issue with row selections when implementing server side pagination. The logic worked well with local data, but once I switched to server side pagination, the checkboxes' selections didn't render properly when navigating back and forth between pages where rows were previously selected.
private setupCheckboxIfPageChange() {
console.log(1);
const selected: TestTable[] = this.selection.selected;
this.selection.clear();
this.selection.select(...selected);
}
To address this problem, I created a function that is triggered in the API subscription. You can check out an example of my attempted solution here.