0 points

Delete db from server item with dynamic HTML without data-tables


dashboard

Thu Oct 29 2020 00:33:32 GMT+0000 (UTC)

Posted by @narro

<template>
  <div class="selectedCard">
    <div class="allPaymentsDelete"
      v-for="payment in this.debtorPayments" :key="payment.id">
    <a class="deletePaymentX" @click="deletePaymentFormat(payment.id)">X</a>
      {{ formatDateMDY(payment.paymentdate.split("T")[0]) }}
      {{ payment.assignedto }}
      {{ payment.paymentstatus }}
    </div>
  </div>
</template>
          
<script>
  methods: {
    deletePaymentFormat(pid) {
      let url = `${this.baseURL}deletepaymentbypid`;
      let params = {
        pid: pid,
        host: this.serverDBase,
        user: this.userDBase,
        password: this.passDBase,
        schema: this.schemaDBase,
      };
      this.deletePaymentByPid(url, params);
    },
    
    deletePaymentByPid(url, params) {
      axios
        .post(url, params)
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.error(err);
      });
    },
  }
</script>

<style>
.deletePaymentX {
  color: red;
  font-weight: bold;
  text-decoration: none;
}
</style>
content_copy Copy

This script lets you make an API call with Axios to delete items using mostly HTML See: https://imgur.com/a/5jMFN2V

https://imgur.com/a/5jMFN2V