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']; $objet = $flux['args']['type'];
if ( if (
$id = intval($id) $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 { } 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; return $flux;

View file

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

View file

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