Suppression d'un elt si une action comme le changemnet de statut supprime cet elt dans le json
This commit is contained in:
parent
0cbff3a5cf
commit
ff06fe9b69
2 changed files with 19 additions and 6 deletions
|
@ -256,8 +256,13 @@ let monTableau = {
|
||||||
this.classes = config.classes;
|
this.classes = config.classes;
|
||||||
}
|
}
|
||||||
if (parseInt(id) > 0) {
|
if (parseInt(id) > 0) {
|
||||||
let i = this.table.findIndex((ligne) => ligne.html.id === parseInt(id));
|
if (data.length > 0) {
|
||||||
Vue.set(this.table, i, data[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 {
|
} else {
|
||||||
this.table = data;
|
this.table = data;
|
||||||
if (data[0] && data[0].search) {
|
if (data[0] && data[0].search) {
|
||||||
|
|
|
@ -307,11 +307,19 @@ var monTableau = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseInt(id) > 0) {
|
if (parseInt(id) > 0) {
|
||||||
var i = _this2.table.findIndex(function (ligne) {
|
if (data.length > 0) {
|
||||||
return ligne.html.id === parseInt(id);
|
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 {
|
} else {
|
||||||
_this2.table = data;
|
_this2.table = data;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue