Feat: on recharge en prenant en compte le timestamp
TODO : la suppression
This commit is contained in:
parent
778f9a2c44
commit
1ac31ccb9d
3 changed files with 37 additions and 15 deletions
|
@ -15,8 +15,8 @@ if (!defined("_ECRIRE_INC_VERSION")) {
|
|||
include_spip("inc/vite");
|
||||
|
||||
function gamutable_fermer_modalbox($id_objet = 9999999999, $num = null) {
|
||||
if ($num) {
|
||||
$num = '_deux';
|
||||
if ($id_objet === 'maj') {
|
||||
$id_objet = 1;
|
||||
}
|
||||
$html = <<<EOJS
|
||||
<script type="text/javascript">
|
||||
|
@ -24,13 +24,19 @@ function gamutable_fermer_modalbox($id_objet = 9999999999, $num = null) {
|
|||
id = parseInt(id);
|
||||
if (id > 0 && id < 9999999999) {
|
||||
if (typeof app !== 'undefined') {
|
||||
app$num.rechargerJson(id);
|
||||
app.rechargerJson('maj');
|
||||
}
|
||||
if (typeof app_deux !== 'undefined') {
|
||||
app_deux.rechargerJson('maj');
|
||||
}
|
||||
$.modalboxclose();
|
||||
}
|
||||
if (id === 9999999999) {
|
||||
if (typeof app !== 'undefined') {
|
||||
app$num.rechargerJson();
|
||||
app.rechargerJson();
|
||||
}
|
||||
if (typeof app_deux !== 'undefined') {
|
||||
app_deux.rechargerJson();
|
||||
}
|
||||
$.modalboxclose();
|
||||
}
|
||||
|
@ -41,8 +47,8 @@ EOJS;
|
|||
}
|
||||
|
||||
function gamutable_recharger_tableau($id_objet = 9999999999, $num = null) {
|
||||
if ($num) {
|
||||
$num = '_deux';
|
||||
if ($id_objet === 'maj') {
|
||||
$id_objet = 1;
|
||||
}
|
||||
$html = <<<EOJS
|
||||
<script type="text/javascript">
|
||||
|
@ -50,12 +56,18 @@ function gamutable_recharger_tableau($id_objet = 9999999999, $num = null) {
|
|||
id = parseInt(id);
|
||||
if (id > 0 && id < 9999999999) {
|
||||
if (typeof app !== 'undefined') {
|
||||
app$num.rechargerJson(id);
|
||||
app.rechargerJson('maj');
|
||||
}
|
||||
if (typeof app_deux !== 'undefined') {
|
||||
app_deux.rechargerJson('maj');
|
||||
}
|
||||
}
|
||||
if (id === 9999999999) {
|
||||
if (typeof app !== 'undefined') {
|
||||
app$num.rechargerJson();
|
||||
app.rechargerJson();
|
||||
}
|
||||
if (typeof app_deux !== 'undefined') {
|
||||
app_deux.rechargerJson();
|
||||
}
|
||||
}
|
||||
delete id;
|
||||
|
|
|
@ -54,7 +54,7 @@ function gamutable_crayons_vue_affichage_final($flux){
|
|||
$id = intval($id)
|
||||
and !in_array($objet, $GLOBALS['gamutable_rechargerJson_all'] ?? [])
|
||||
) {
|
||||
$flux['data'] .= ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson('.$id.');}if ( typeof app === "object") { app.rechargerJson('.$id.');} </script>';
|
||||
$flux['data'] .= ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson("maj");}if ( typeof app === "object") { app.rechargerJson("maj");} </script>';
|
||||
} else {
|
||||
$flux['data'] .= $objet . ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson();}if ( typeof app === "object") { app.rechargerJson();} </script>';
|
||||
}
|
||||
|
|
|
@ -667,6 +667,21 @@ function gererData(filtreColRecup, data, id = null) {
|
|||
nameLocalStorage.value,
|
||||
JSON.stringify(table.value)
|
||||
);
|
||||
} else if (id === "maj") {
|
||||
console.log("table.value = ", table.value);
|
||||
if (data[0] && data[0].search) {
|
||||
champ_search.value = "search";
|
||||
}
|
||||
if (data.length > 0) {
|
||||
data.forEach((ligne, index) => {
|
||||
let i = trouver_index(table.value, ligne.html.id);
|
||||
table.value[i] = data[index];
|
||||
});
|
||||
}
|
||||
localforage.setItem(
|
||||
nameLocalStorage.value,
|
||||
JSON.stringify(table.value)
|
||||
);
|
||||
} else {
|
||||
table.value = data;
|
||||
if (data[0] && data[0].search) {
|
||||
|
@ -791,6 +806,7 @@ function saveHeader() {
|
|||
classes: classes.value,
|
||||
filtreCol: filtreColType.value,
|
||||
ordreCol: ordreCol.value,
|
||||
maj: maj.value,
|
||||
};
|
||||
localStorage.setItem(
|
||||
"header_" + nameLocalStorage.value,
|
||||
|
@ -801,14 +817,8 @@ function deleteInputSearch(head) {
|
|||
loadingVueSelect.value = false;
|
||||
filtreColSelected.value[head] = [];
|
||||
}
|
||||
function hanldeSearchInput(event, head) {
|
||||
searchInputHead.value = head;
|
||||
searchInputVal.value = event.target.value;
|
||||
}
|
||||
function selectValCol() {
|
||||
filtreColModif.value++;
|
||||
searchInputVal.value = "";
|
||||
searchInputHead.value = "";
|
||||
}
|
||||
function endLoadingVueSelect() {
|
||||
loadingVueSelect.value = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue