I am using a mat-table to list the content of the users chosen languages. They can also add new languages using dialog panel. After they added a language and returned back.
After reading Material Table not updating post data update #11638 Bug Report I found the best (read, the easiest solution) was as suggested by the final commentor 'shhdharmen' with a suggestion to use an EventEmitter.
This involves a few simple changes to the generated datasource class
ie) add a new private variable to your datasource class
import { EventEmitter } from '@angular/core';
...
private tableDataUpdated = new EventEmitter();
and where I push new data to the internal array (this.data), I emit an event.
public addRow(row:myRowInterface) {
this.data.push(row);
this.tableDataUpdated.emit();
}
and finally, change the 'dataMutation' array in the 'connect' method - as follows
const dataMutations = [
this.tableDataUpdated,
this.paginator.page,
this.sort.sortChange
];