Tried to get table's tr second td value but not working.I think closest is not working in chrome or firefox properly. I am using this script in angular 6.How to resolve this issue?
const target = e.originalEvent.toElement.closest('td');
Tried to get table's tr second td value but not working.I think closest is not working in chrome or firefox properly. I am using this script in angular 6.How to resolve this issue?
const target = e.originalEvent.toElement.closest('td');
When reading the title of your question and looking at the option "Get ID" from your drop-down, I assume that you simply want to know how to write the ID of the current table row to component.selectedVal
.
Since you're building individual table rows by iterating over the component.data
array, the solution is straight forward. Just add below event handler to your p-dropdown
element and get rid of the method component.onSelectType
.
(onChange)="selectedVal= data"
Please have look at this StackBlitz