irossimoline/angular4-material-table

TableDataSource should extend MatTableDataSource instead of DataSource

Opened this issue · 6 comments

Hi irossimoline,

First of all, what you've developed is very cool and useful.
I think it could even be better with few changes.
TableDataSource should extend MatTableDataSource instead of DataSource. Like that, TableDataSource would inherited the filter and sort methods which are provided OOTB by Material.

Hi @MarcoLasticot,

I think it could be done with a kind of big refactoring, but to keep being backwards compatible we must consider:

  • Do not enforce to depend on @angular/material package. It could be present, or it couldn't, and should be OK.
  • Keep extending DataSource, and have another structure that extends MatTableDataSource (again, backwards compatibility).
  • On the code used, try to share the most amount of code posible between both structures.
  • Recheck CRUD implementation to validate that filter and sort methods don't interfere with current implementation. Regarding this specific point, I think it would create some issues, because we are currently handling everything with the index in the array, but that value won't be a source of truth anymore using filter/sorting. We should provide a way to specify which is/are the key(s) in the list object's type provided to the list, and then modify the code to use that key.

This would require a quite big amount of work, I'm not sure I could tackle it soon. Anyway, if someone want to help with it, it would be appreciated.

Hey guys! Was there any advance with this issue?

Hi guys,
I'm using your library and it has been very useful so far. The only thing missing is that I can't use sort and filter functionalities, and I really need it. Thanks for all the hard work so far :-)

He @irossimoline , I'd be willing to help taking into account backwards compatibility. But I'd like to do it together since you're the author. Maybe we can set up a feature branch or something?

Hi @boazhuisman, sure I would love a solution that takes backwards compatibility into account.

I've created a branch named feature/allow-extend-material-table and added you as a collaborator, so you can start from there.

I don't have much available time right now, but please mention me anywhere you need extra help and I'll be willing to help you.

Any update on this issue