Reputation: 201
I want to avoid the user to click another button (edit button) in another row when the update is not done yet. I want the user to click the save button first before editing another row. How can I remove the textbox or back it to original form when clicking the save button? This is the jsfiddle https://jsfiddle.net/2mh5yjeb/4/
new Vue({
el: "#app",
data: {
editMode: false,
users: [
{ name: 'mimi', email: '[email protected]'},
{ name: 'sam', email: '[email protected]'},
{ name: 'kev', email: 'wewe'}
],
editedUser: null
},
methods: {
saveData () {
},
editData (user) {
this.beforEditCache = user
this.editedUser = user
}
}
})
Upvotes: 0
Views: 58
Reputation: 3908
<button @click="editData(user)":disabled='editDisabled'>edit</button>
new Vue({
el: "#app",
data: {
editMode: false,
users: [
{ name: 'mimi', email: '[email protected]'},
{ name: 'sam', email: '[email protected]'},
{ name: 'kev', email: 'wewe'}
],
editedUser: null,
editDisabled: false
},
methods: {
saveData () {
this.editDisabled = false
this.editUser = null
this.beforEditCache = null
this.editedUser = null
},
editData (user) {
this.editDisabled = true
this.beforEditCache = user
this.editedUser = user
}
}
})
Here is the jsfiddle, hope it helps :)
Upvotes: 2