I am currently working on code to populate a datatable with rows. Each row in the datatable contains an update
link, which when clicked should trigger the ShowModal()
method.
How can I invoke the ShowModal()
function using this <a>
element?
<template>
<table id="buildings" class="mdl-data-table" width="100%"></table>
</template>
methods: {
ShowModal(buildingId){
// do something here...
},
listBuildings() {
axios
.get("https://localhost:44349/api/Building/List", headers)
.then(response => {
response.data.forEach(el => {
this.dataset.push([
el.buildingId,
el.projectName,
el.city,
`<a click='${this.ShowModal(el.buildingId)}'>Update</a>` // Trying to make this work
]);
$("#buildings").DataTable({
data: this.dataset});
});
}