feat: si data-id est négatif, cela supprime la ligne (dans le cas d'une action url_action)

This commit is contained in:
Christophe 2024-04-17 08:56:26 +02:00
parent 2d810faf27
commit 3b4ca5a672
2 changed files with 108 additions and 85 deletions

View file

@ -302,6 +302,8 @@ let nameLocalStorage = calculer_nameLocalStorage();
let filtreColValeurs = [];
onMounted(() => {
localforage.setDriver(localforage[props.stockage.toUpperCase()]);
chargerJson("maj");
@ -443,6 +445,7 @@ const tableau = computed(() => {
});
return pagination(ttt);
});
function saveTriCol() { }
//~~~~~~~~~~~~~~~~~~~~~~~~~
// les watchers
@ -988,5 +991,16 @@ function rechargerJson(id, ajax_Crayons = true) {
ajaxCrayons = ajax_Crayons;
chargerJson(id);
}
defineExpose({ rechargerJson });
function delLigne(id) {
if (id < 0) {
id = id * -1;
}
console.log("delLigne : ", id);
let i = trouver_index(table.value, id);
if (i !== -1) {
table.value.splice(i, 1);
}
}
defineExpose({ rechargerJson, delLigne });
</script>

View file

@ -21,6 +21,7 @@ function gamutable() {
components,
mounted() {
app.rechargerJson = this.$refs.montableau.rechargerJson;
app.delLigne = this.$refs.montableau.delLigne;
},
});
app.use(VuePapaParse);
@ -31,6 +32,7 @@ function gamutable() {
components,
mounted() {
app_deux.rechargerJson = this.$refs.montableau_deux.rechargerJson;
app_deux.delLigne = this.$refs.montableau_deux.delLigne;
},
});
app_deux.use(VuePapaParse);
@ -88,6 +90,13 @@ $('#vueGamutable').on('click', '.url_action, .url_action--ss_css', function (e)
if (Treload2) {
app_deux.rechargerJson(id);
}
} else if (parseInt(id) < 0) {
if (Treload1) {
app.delLigne(id);
}
if (Treload2) {
app_deux.delLigne(id);
}
} else {
if (Treload1) {
app.rechargerJson('maj 1');