#101342
yavordashew
Member

Hi Johnny Johnny,
We have prepared a complete solution for your specific case.
This is the code snippet of the solution with it you can delete selected rows(multiple or all selected):
document.getElementById(‘remove’).onclick = function () {
if (table.dataSource.length > 0) {
let selectedIds = table.getSelection().slice();
for(let i=0; i<selectedIds.length;i++){
const selectedId = selectedIds[i];
const rowIndex = Array.from(document.querySelectorAll(‘tr[row-id]’)).findIndex(tr => tr.getAttribute(‘row-id’) === selectedId + ”);
table.dataSource.removeAt(rowIndex)
}
}
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/