Skip to content
Advertisement

How to embed button with Vue code into cell inserted with insertCell()?

I have Vue component with a table with users data:

JavaScript

The button in the last <td> successfully deletes worker from the table. Function toggleChildWorkers insert new rows with child workers and delete (hide, actually) them like this:

JavaScript

As you can see, I’m trying to embed buttons in the new cells of inserted rows (blue ones). But they are not displayed as it was intended and don’t work at all.

enter image description here

How can I embed button with Vue code into new cell of inserted row?

Advertisement

Answer

I found a simple solution here. But I did’t understand it at the beginning and use it without closure and it did’t work as I expected. Then I found topic about Javascript infamous loop issue and used the closure magic:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement