Fix: correction sur le rechargement du gamutable à la validation des

crayons sur les 2 tableaux
This commit is contained in:
Christophe 2023-01-12 00:32:14 +01:00
parent 3405333a4d
commit 4608e25fdf
3 changed files with 15 additions and 19 deletions

View file

@ -52,11 +52,11 @@ function gamutable_crayons_vue_affichage_final($flux){
$objet = $flux['args']['type'];
if (
$id = intval($id)
and (!empty($GLOBALS['gamutable_rechargerJson_all']) and !in_array($objet, $GLOBALS['gamutable_rechargerJson_all']))
and !in_array($objet, $GLOBALS['gamutable_rechargerJson_all'] ?? [])
) {
$flux['data'] .= ' <script type="text/javascript">if ( typeof app === "function") { app.rechargerJson('.$id.');} </script>';
$flux['data'] .= ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson('.$id.');}if ( typeof app === "object") { app.rechargerJson('.$id.');} </script>';
} else {
$flux['data'] .= ' <script type="text/javascript">if ( typeof app === "function") { app.rechargerJson();} </script>';
$flux['data'] .= $objet . ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson();}if ( typeof app === "object") { app.rechargerJson();} </script>';
}
return $flux;

View file

@ -1090,15 +1090,12 @@ function trouver_index(table, id) {
});
return i;
}
function rechargerJson(id, ajaxCrayons = true) {
ajaxCrayons = ajaxCrayons;
function rechargerJson(id, ajax_Crayons = true) {
console.log("rechargerJson");
ajaxCrayons = ajax_Crayons;
chargerJson(id);
}
function rechargerJson_deux(id, ajaxCrayons = true) {
ajaxCrayons = ajaxCrayons;
chargerJson(id);
}
defineExpose({ rechargerJson, rechargerJson_deux });
defineExpose({ rechargerJson });
</script>
<style scoped>

View file

@ -1,19 +1,19 @@
// https://vitejs.dev/config/#build-polyfillmodulepreload
import "vite/modulepreload-polyfill";
import 'vite/modulepreload-polyfill';
// Vue
import { createApp } from "vue";
import { createApp } from 'vue';
// if importing all is too much you can always do it manually
import GamuTable from "./components/gamuTable.vue";
import VuePapaParse from "vue-papa-parse";
import GamuTable from './components/gamuTable.vue';
import VuePapaParse from 'vue-papa-parse';
const components = {
GamuTable,
};
let i = 1;
for (const el of document.getElementsByClassName("vue-gamutable")) {
for (const el of document.getElementsByClassName('vue-gamutable')) {
if (i === 1) {
window.app = createApp({
components,
@ -22,18 +22,17 @@ for (const el of document.getElementsByClassName("vue-gamutable")) {
},
});
app.use(VuePapaParse);
app.provide("$papa", app.config.globalProperties.$papa);
app.provide('$papa', app.config.globalProperties.$papa);
app.mount(el);
} else if (i === 2) {
window.app_deux = createApp({
components,
mounted() {
app_deux.rechargerJson =
this.$refs.montableau_deux.rechargerJson;
app_deux.rechargerJson = this.$refs.montableau_deux.rechargerJson;
},
});
app_deux.use(VuePapaParse);
app_deux.provide("$papa", app_deux.config.globalProperties.$papa);
app_deux.provide('$papa', app_deux.config.globalProperties.$papa);
app_deux.mount(el);
}
i++;