Commit 21fffaab authored by Mat's avatar Mat

la fonction reloadTableMembre, et le bouton de refresh

parent 67d77728
......@@ -76,3 +76,4 @@ fos_js_routing:
routes_to_expose:
- api_owner_*
- api_image_*
- api_membre_*
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -39,6 +39,66 @@
{% block body %}
<h2>{{ block('title') }}</h2>
<table id="maintab" class="table membres">
<thead>
<tr>
<th scope="col">
<a href="javascript: void(0);" class="btn-sort">#</a>
</th>
<th scope="col">
<a href="javascript: void(0);" class="btn-sort">Nom</a>
</th>
<th scope="col">
<a href="javascript: void(0);" class="btn-sort">Prenom</a>
</th>
<th scope="col">
<a href="javascript: void(0);" class="btn-sort">Email</a>
</th>
<th scope="col">
<a href="javascript: void(0);" class="btn-sort">Association</a>
</th>
<th scope="col">
<a href="javascript: void(0);" class="btn-sort">Action</a>
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
{% endblock %}
{% block customJS %}
<script type="text/javascript" src="{{ asset('js/script.js') }}"></script>
<script type="text/javascript">
let submitURL = null;
let table = document.querySelector('table#maintab.membres');
let tbody = table.querySelector('tbody');
let membreURL = Routing.generate('api_membre_read_paginate');
function reloadTableMembre() {
tbody.innerHTML = null;
AJAX('GET', membreURL, function(request)
{
tr = document.createElement('tr');
td1 = document.createElement('td');
td1.textContent = 'hop';
tr.appendChild(td1);
tbody.appendChild(tr);
});
}
reloadTableMembre();
let reloadBtns = document.querySelectorAll('.btn-reload');
reloadBtns.forEach(function(reloadBtn) {
reloadBtn.addEventListener('dblclick', function(e) {
console.log('refresh');
reloadTableMembre();
});
});
</script>
{% endblock %}
Markdown is supported
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