swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

Using expressive columns inside of another template results in duplicated columns #183

Open ashleahhill opened 7 years ago

ashleahhill commented 7 years ago

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior

I am using angular2-data-table inside of Angular Material 2 tabs

When I use the Expressive functionality I end up with duplicate columns after tabbing away from and back to a table using expressive templates.

I do not see the issue when using the headerTemplate and cellTemplate with TableOptions, nor do I see them with tables that don't use templates.

Expected behavior

Sort should happen without throwing error.

Reproduction of the problem http://plnkr.co/edit/9Eug63qi775HVCMe3BhO?p=preview

  1. See 5 columns on the 'Expressive: Cars' tab
  2. choose another tab
  3. Go back to 'Expressive: Cars', see 10 columns
  4. choose another tab
  5. Go back to 'Expressive: Cars', see 15 columns

What is the motivation / use case for changing the behavior?

I need to use the table inside of an angular material tab

Please tell us about your environment: Windows VSCode Node Webpack Dev Server

TypeScript@2.0.3

amcdnl commented 7 years ago

Can you verify if this is still an issue?