Commit 558ce7e1 authored by Mat's avatar Mat
Browse files

Legume/ajaxDisplay, divers détails, cherche le bug des requêtes ajax...

Legume/ajaxDisplay, divers détails, cherche le bug des requêtes ajax superposées pour le champs de recherche
parent 082a627b
......@@ -116,11 +116,13 @@
*/
function reloadTableLegume(paginate)
{
tbody.innerHTML = null;
//console.log(paginate);
let legumeURL = Routing.generate('api_legume_read', paginate);
displayPagination(paginate);
refreshTableBodyLegume(legumeURL);
getTableBodyLegume(legumeURL);
}
......@@ -172,7 +174,12 @@
removePagination();
refreshSearchStats(searchURL);
refreshTableBodyLegume(searchURL);
tbody.innerHTML = null;
sleep(1000).then(() => {
// TODO le sleep est encore buggé
getTableBodyLegume(searchURL);
});
}
......@@ -202,9 +209,8 @@
/*
* Rafraîchit l'affichage de la table légume
*/
function refreshTableBodyLegume(URL)
function getTableBodyLegume(URL)
{
tbody.innerHTML = null;
AJAX('GET', URL, function(request)
{
let json = JSON.parse(request.responseText);
......@@ -469,6 +475,8 @@
let step = (this.value === '-1') ? 10 : this.value;
paginate.step = parseInt(step);
paginate.page = 1;
searchField.value = null;
reloadTableLegume(paginate);
});
......@@ -507,25 +515,17 @@
searchField.addEventListener('input', function()
{
qString = this.value;
if (qString.length >= 3) {
// setTimeout(function(){ }, 500);
reloadTableSearchLegume({'q': qString });
}
if (qString.length === 0) {
reloadTableLegume(paginate);
} else {
if (qString.length >= 3)
{
stepform.value = -1;
reloadTableSearchLegume({'q': qString });
}
}
});
/*
searchField.addEventListener('blur', function()
{
this.value = null;
decompte(3, function() {
reloadTableLegume(paginate);
});
});
*/
</script>
{% endblock %}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment