correction gestion des 2 composants

This commit is contained in:
Christophe 2020-11-04 22:12:22 +01:00
parent a05c26c6ed
commit 1672098bab
3 changed files with 29 additions and 32 deletions

View file

@ -17,21 +17,25 @@
ref="montableau"
></mon-tableau>
</div>
<span class="[(#ENV{apiuri_deux})gamutableSep]"></span>
<div class="gamutableDeux">
[<span class="titre titreGamutableDeux">(#ENV{titreGamutableDeux})</span>]
<mon-tableau
apiuri="[(#ENV{apiuri_deux})]"
:tparpage="#ENV{tparpage_deux, [10, 20, 50, 'Tous']}"
champcsv="[(#ENV{champcsv,html})]"
delimitercsv="[(#ENV{delimitercsv,','})]"
namecsv="[(#ENV{namecsv_deux})]"
urlvuebloc="[(#ENV{urlvuebloc_deux})]"
url_sort_asc="[(#ENV{sort_asc,#GET{sort_asc}})]"
url_sort_desc="[(#ENV{sort_desc,#GET{sort_desc}})]"
ref="montableau"
></mon-tableau>
</div>
<BOUCLE_deux(CONDITION){si #ENV{apiuri_deux}|oui}>
<span class="gamutableSep"></span>
<div class="gamutableDeux">
[<span class="titre titreGamutableDeux">(#ENV{titreGamutableDeux})</span>]
<mon-tableau
apiuri="[(#ENV{apiuri_deux})]"
:tparpage="#ENV{tparpage_deux, [10, 20, 50, 'Tous']}"
champcsv="[(#ENV{champcsv,html})]"
delimitercsv="[(#ENV{delimitercsv,','})]"
namecsv="[(#ENV{namecsv_deux})]"
urlvuebloc="[(#ENV{urlvuebloc_deux})]"
url_sort_asc="[(#ENV{sort_asc,#GET{sort_asc}})]"
url_sort_desc="[(#ENV{sort_desc,#GET{sort_desc}})]"
ref="montableau"
></mon-tableau>
</div>
</BOUCLE_deux>
</div>
<script type="text/javascript">

View file

@ -26,9 +26,7 @@ jQuery(function () {
if (nomBlocAjaxReload !== undefined) {
ajaxReload(nomBlocAjaxReload, {
args: { id },
callback: function () {
console.log('couco reload');
},
callback: function () {},
});
}
});
@ -147,11 +145,6 @@ function trouver_index(table, id) {
});
return i;
}
String.fromHtmlEntities = function (string) {
return (string + '').replace(/&#\d+;/gm, function (s) {
return String.fromCharCode(s.match(/\d+/gm)[0]);
});
};
let monTableau = {
props: {
tparpage: {
@ -262,7 +255,10 @@ let monTableau = {
},
methods: {
calculer_nameLocalStorage() {
return this.apiuri.match(/.*page=(.*)/)[1];
if (this.apiuri) {
return this.apiuri.match(/.*page=(.*)/)[1];
}
return '';
},
chargerJson(id) {
let url = this.apiuri;
@ -304,7 +300,6 @@ let monTableau = {
this.table[i] = data[0];
} else {
let i = trouver_index(this.table, id);
console.log('index ', i);
this.table.splice(i, 1);
}
} else {

View file

@ -196,12 +196,6 @@ function trouver_index(table, id) {
return i;
}
String.fromHtmlEntities = function (string) {
return (string + '').replace(/&#\d+;/gm, function (s) {
return String.fromCharCode(s.match(/\d+/gm)[0]);
});
};
var monTableau = {
props: {
tparpage: {
@ -308,7 +302,11 @@ var monTableau = {
},
methods: {
calculer_nameLocalStorage: function calculer_nameLocalStorage() {
return this.apiuri.match(/.*page=(.*)/)[1];
if (this.apiuri) {
return this.apiuri.match(/.*page=(.*)/)[1];
}
return 'a';
},
chargerJson: function chargerJson(id) {
var _this3 = this;