I am trying to build a table dynamically from the javascript which runs is already in Aura component.
tableBody = tableBody + '<tr>';
tableBody = tableBody + '<td><a href="javascript:void(0)" id="' + datas[i].Id + '" data-recname ="' +
datas[i].Name + '" onclick="selectedRow(this)">' + datas[i].Name + '</a></td>';
When I tried to build the same in LWC javascript as
<td><input type="checkBox" data-selectedrec="'+data[i]['Id']+'" onclick="{selectedRow}"></input> </td>
Dom gets created and getting an checkbox input but onclick function is not getting added in the DOM. What am I missing here?
lightning-datatable
. Anyway, you need to add the event listener using js. check this – rahul gawale Jul 31 '20 at 13:08