Skip to content

Commit

Permalink
docs: monospace DataSource (table docs) (#22114)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexElin committed Mar 9, 2021
1 parent a1e0056 commit 0950cd5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/material/table/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,21 @@ automatically trigger an update to the rows each time a new data array is emitte

#### DataSource

For most real-world applications, providing the table a DataSource instance will be the best way to
manage data. The DataSource is meant to serve as a place to encapsulate any sorting, filtering,
For most real-world applications, providing the table a `DataSource` instance will be the best way to
manage data. The `DataSource` is meant to serve as a place to encapsulate any sorting, filtering,
pagination, and data retrieval logic specific to the application.

A DataSource is simply a class that has at a minimum the following methods: `connect` and
`disconnect`. The `connect` method will be called by the table to provide an Observable that emits
A `DataSource` is simply a class that has at a minimum the following methods: `connect` and
`disconnect`. The `connect` method will be called by the table to provide an `Observable` that emits
the data array that should be rendered. The table will call `disconnect` when the table is destroyed,
which may be the right time to clean up any subscriptions that may have been registered in the
`connect` method.

Although Angular Material provides a ready-made table DataSource class, `MatTableDataSource`, you may
want to create your own custom DataSource class for more complex use cases. This can be done by
extending the abstract DataSource class with a custom DataSource class that then implements the
`connect` and `disconnect` methods. For use cases where the custom DataSource must also inherit
functionality by extending a different base class, the DataSource base class can be
Although Angular Material provides a ready-made table `DataSource` class, `MatTableDataSource`, you may
want to create your own custom `DataSource` class for more complex use cases. This can be done by
extending the abstract `DataSource` class with a custom `DataSource` class that then implements the
`connect` and `disconnect` methods. For use cases where the custom `DataSource` must also inherit
functionality by extending a different base class, the `DataSource` base class can be
implemented instead (`MyCustomDataSource extends SomeOtherBaseClass implements DataSource`) to
respect Typescript's restriction to only implement one base class.

Expand Down

0 comments on commit 0950cd5

Please sign in to comment.