Feat: ajout du url_action
This commit is contained in:
parent
d40343e2cc
commit
f135e978f8
1 changed files with 42 additions and 0 deletions
|
@ -37,3 +37,45 @@ for (const el of document.getElementsByClassName('vue-gamutable')) {
|
|||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
$('#vueGamutable').on('click', '.url_action', function (e) {
|
||||
console.log('coucou');
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
let confirmation = $(this).data('confirm');
|
||||
if (confirmation !== undefined) {
|
||||
if (!confirm(confirmation)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let url = $(this).attr('href');
|
||||
let id = $(this).data('id');
|
||||
// passer en refresh animé une éventuelle icone
|
||||
if ($(this).has('i.icon, i.fa')) {
|
||||
$(this).find('i.icon, i.fa').eq(0).replaceWith('<i class="fa fa-refresh fa-spin"></i>');
|
||||
}
|
||||
let nomBlocAjaxReload = $(this).data('ajaxreload');
|
||||
console.time('Chargement de VueJs APRES Ajax');
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
}).done(function (retour) {
|
||||
if (!$.isEmptyObject(retour) && !$.isEmptyObject(retour.message_erreur)) {
|
||||
alert(retour.message_erreur);
|
||||
} else {
|
||||
if (parseInt(id) > 0) {
|
||||
app.rechargerJson(id);
|
||||
} else {
|
||||
app.rechargerJson();
|
||||
}
|
||||
if (nomBlocAjaxReload !== undefined) {
|
||||
console.log('depart reload: ' + nomBlocAjaxReload);
|
||||
ajaxReload(nomBlocAjaxReload, {
|
||||
args: { id },
|
||||
callback: function () {},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue