Suppression d'un elt si une action comme le changemnet de statut supprime cet elt dans le json

This commit is contained in:
Christophe 2020-08-20 00:15:41 +02:00
parent 0cbff3a5cf
commit ff06fe9b69
2 changed files with 19 additions and 6 deletions

View file

@ -256,8 +256,13 @@ let monTableau = {
this.classes = config.classes;
}
if (parseInt(id) > 0) {
let i = this.table.findIndex((ligne) => ligne.html.id === parseInt(id));
Vue.set(this.table, i, data[0]);
if (data.length > 0) {
let i = this.table.findIndex((ligne) => ligne.html.id === parseInt(id));
Vue.set(this.table, i, data[0]);
} else {
let i = this.table.findIndex((ligne) => ligne.html.id === parseInt(id));
Vue.delete(this.table, i);
}
} else {
this.table = data;
if (data[0] && data[0].search) {

View file

@ -307,11 +307,19 @@ var monTableau = {
}
if (parseInt(id) > 0) {
var i = _this2.table.findIndex(function (ligne) {
return ligne.html.id === parseInt(id);
});
if (data.length > 0) {
var i = _this2.table.findIndex(function (ligne) {
return ligne.html.id === parseInt(id);
});
Vue.set(_this2.table, i, data[0]);
Vue.set(_this2.table, i, data[0]);
} else {
var _i2 = _this2.table.findIndex(function (ligne) {
return ligne.html.id === parseInt(id);
});
Vue.delete(_this2.table, _i2);
}
} else {
_this2.table = data;