javascript – Autodesk forge viewer table row click to isolate elements

I am trying to create a dynamic table inside the viewer’s page.
each row of the table represents an object from the model and has a couple of different parameters ( name, level, etc..)
I want to make a click event on each row, that isolates the element in the viewer’s model.

I have created the table programmatically using js. (the table is created after pressing an external command button )

how can I add an event listener to a row click, that would isolate the element?

this is my code for creating the table after pressing the command button:

”’` var myTable = $(‘.my-table’);
var myArr=rows; //matrix of object values

                        for(var i=0; i<myArr.length;i++)
                        myTable.append("<tr id="+i+">"
                                            +" <td>"+myArr[i][0]+"</td>"
                                            +"<td>"+myArr[i][1]+"</td>" 
                                            +"<td>"+myArr[i][2]+"</td>"  
                                            +"<td>"+myArr[i][3]+"</td>"  
                                            +"<td>"+myArr[i][4]+"</td>"
                                            +"<td>"+myArr[i][5]+"</td>"
                                            +"<td>"+myArr[i][6]+"</td>" 
                                            +"<td id="+"tt"+">"+myArr[i][7]+"</td>"                     
                                +"</tr>");
                                const row = document.getElementById(`${i}`);
                                row.addEventListener('onClick', function (evt, item) {/// we are using a viewer api property to  isolate the 
                                    _this.viewer.isolate(_this.modelData.getIds(myArrNames[i][1],item[0]._model.label));
                                   
                                });`

Read more here: Source link