Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkable change event #39

Open
mhelaiwa opened this issue Sep 27, 2017 · 0 comments
Open

Checkable change event #39

mhelaiwa opened this issue Sep 27, 2017 · 0 comments

Comments

@mhelaiwa
Copy link

I have a toggle inside a column of vuetiful datatable listening to its change event.
I want to it when changed to send a request to the back-end to store the change in the database.
The problem is the change event triggered multiple times when I bind the datatable with new data in the mounted function. This will make a request for every toggle in the datatable at the beginning.
Any way to overcome this problem?
thanks

Html:

<template slot="active" scope="cell">
   <toggle :change="toggle(cell.row)" :key="cell.row.id" :id="'toggle-'+cell.row.id" :value="cell.row" v-model="cell.row.active"></toggle>
</template>

Script:

<script>
export default {
   template: require('../../templates/permissions/roles.html'),
      components: {
         Modal, Popover
      },
      data(){
         return {
            tableData:[]
         }
      },
      mounted() {
         axios.get('/api/roles').then(({data}) => {
            this.tableData = data;
         });
      },
      methods:{
         toggle(row){
            console.log(row);
         }
      }
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant