components icon indicating copy to clipboard operation
components copied to clipboard

[table] add example how to write generic code for md-table

Open Bsujeet opened this issue 9 years ago • 4 comments

Bug, feature request, or proposal:

how to write generic data table for dynamic columns with sorting,filtering and pagination.

What is the expected behavior?

seeing implementation instructions and/or an example of how to write generic code if their are multiple tables on page.

What is the current behavior?

I have to repeat the classes for database and data source for each table as switch case hard coded column names in it.

What is the use-case or motivation for changing an existing behavior?

i have to write multiple classes for multiple tables in my component.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

angular 4 material 2 typescript 2.4 windows

Is there anything else we should know?

Bsujeet avatar Nov 06 '17 11:11 Bsujeet

You have a couple options,

  1. Write your data source to be more generic
  2. Wait until the next release and use MatTableDataSource (docs being updated in https://github.com/angular/material2/pull/8162)

willshowell avatar Nov 06 '17 13:11 willshowell

Please keep GitHub issues for bug reports / feature requests. Better avenues for troubleshooting / questions are stack overflow, gitter, mailing list, etc.

jelbourn avatar Nov 06 '17 18:11 jelbourn

Thanks @willshowell
and i will keep in mind next time @jelbourn

Bsujeet avatar Nov 07 '17 10:11 Bsujeet

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.