mardi 24 mai 2022

Cannot select row programmatically inside a modal in ng2 smart table Angular

I have an ng2 smart table in my parent component and from this table i open a modal in which i display a second ng2 smart table So on the second table the row should be programmatically selected using this code,

let selectedElement: Element =  document.querySelectorAll('table tbody tr')
          .item(ind); 
         if (selectedElement) {
            let row: HTMLElement = selectedElement.querySelector('td') as HTMLElement;
            row.click();  
          }
       }

but that did not happen as expected, the code selects the row of parents table (table 1)

to resolve this problem i tried to get the second table by ID using this code :

let selectedElement2 : Element = document.querySelectorAll('#tableS table tbody tr').item(ind);

Unfortunately the code didn't find the tr




Aucun commentaire:

Enregistrer un commentaire