Skip to content

Commit ae83977

Browse files
docs(material/table): describe how to properly update MatTableDataSource angular#27708 (angular#29406)
* docs(material/table): describe how to properly update MatTableDataSource Added a description of how to update MatTableDataSource without breaking sorting Fixes angular#27708 * Updated copy from reinstanciate to recreating
1 parent e57c6aa commit ae83977

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/material/table/table.md

+2
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ Note that if the data properties do not match the column names, or if a more com
200200
accessor is required, then a custom `sortingDataAccessor` function can be set to override the
201201
default data accessor on the `MatTableDataSource`.
202202

203+
When updating the data soure asynchronously avoid doing so by recreating the entire `MatTableDataSource` as this could break sorting. Rather update it through the `MatTableDataSource.data` property.
204+
203205
If you are not using the `MatTableDataSource`, but instead implementing custom logic to sort your
204206
data, listen to the sort's `(matSortChange)` event and re-order your data according to the sort state.
205207
If you are providing a data array directly to the table, don't forget to call `renderRows()` on the

0 commit comments

Comments
 (0)