This repository was archived by the owner on Jun 10, 2021. It is now read-only.
This repository was archived by the owner on Jun 10, 2021. It is now read-only.
Access a button event method #61
Closed
Description
This using vue-datasource and in this part when I already select a row, for example I want to call the delete method, but in the console it tells me this "this.deleteProducts() is not a function"
{
text: 'Delete',
icon: 'glyphicon glyphicon-trash',
class: 'btn-danger',
show (selectedRow) {
return true
},
event(e, row) {
console.warn('Are you clicked me?', e);
if(row == null) {
console.info('Ups.. data not found :(')
} else {
console.info('Yeeei, I found this :)', JSON.stringify(row));
this.deleteProducts(); <--------------------------------------
}
}
}
and it does not work. What is the correct way to call the method?
methods: {
deleteProduct: function(id){
var url = 'products/'+id;
axios.delete(url, {
id: this.id
}).then(response => {
this.getProducts();
this.clear();
toastr.success('Se Elimino correctamente');
}).catch(error => {
this.errors = error.response.data;
});
},
}