How to reinstantiate Handontable with Angular wrapper

Tags: #<Tag:0x00007efc6ad1e490>

Hello,
i have a question regarding the angular wrapper for handsontable. I would like to destroy and resinstantiate the table inside the same component. I found a way how to do this with the vanilla Handontable but somehow i dont have a clue how to instantiate Handsontable with the Angular wrapper.
Thanks for your help.

Hey Andre,

It might not be easy. I’ve checked the web for help and found this SO topic https://stackoverflow.com/questions/41354755/what-is-the-best-way-to-delete-a-component-with-cli and there’s one tip from Yakov

  1. Delete the folder containing this component.
  2. In the app.module.ts remove the import statement for this component and remove its name from the declaration section of @NgModule
  3. Remove the line with the export statement for this component from index.ts.

Hello Aleksanda,

im sorry but i think you misunderstood my question. I want to keep the handsontable angular wrapper in my project. We just had the problem that when we entered a component an instance of the handsontable was created and every time we switched to another page with the same compononent the instance wasnt destoryed since the angular ngOnDestroy-Hook (where we normaly unsubsribe or destroy sub-components) didnt fire. So when we switched pages somehow the table added more and more nodes and hooks until the performance was so bad, that the table couldnt be used properly. With the vanilla handsontable i found a way to destroy the instance on page leave and to instantiate it on page entry. But somehow i dont find a way to do this with the angular wrapper and that was what my problem was about.

Thanks for your help again.

Can you share the code of the application or a demo, Andre?
I guess that you’ve already tried to add a exception to attach the instance if the element (parent) is empty?

I cant share the exact code but i can try to set up a short demo which shows the problem. But unfortunately i wont be able to provide the demo this week.
I have to admit that im not exactly sure what you mean by that.

I think that the Handsontable can be added each time user triggers the tab via click event so you should check if the element os already there before processing with building an instance.