I have the following code which I am using to populate a datatable.
For each row in the datatable, I have an update link. clicking the update should call the ShowModal() method.
How can I call ShowModal() from this <a>?
<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>` // I was trying this...
]);
$("#buildings").DataTable({
data: this.dataset});
});
}
tableelement