Commit 73162524bba22d8175fc68afe7a25a887e083841
Committed by
hitier
1 parent
b3cb00e4
Exists in
master
and in
4 other branches
make Tables 'liste agents' and 'liste projets' sortable, searchable and exportable
Showing
3 changed files
with
39 additions
and
3 deletions
Show diff stats
app/main/static/js/style_tables.js
@@ -9,3 +9,15 @@ $('#charge_table').DataTable({ | @@ -9,3 +9,15 @@ $('#charge_table').DataTable({ | ||
9 | 'csvHtml5', | 9 | 'csvHtml5', |
10 | ] | 10 | ] |
11 | }); | 11 | }); |
12 | + | ||
13 | +$('#table_datatables').DataTable({ | ||
14 | + "paginate": false, | ||
15 | + "searching": true, | ||
16 | + "ordering": true, | ||
17 | + "info": false, | ||
18 | + "dom": 'Bfrtip', | ||
19 | + buttons: [ | ||
20 | + 'excelHtml5', | ||
21 | + 'csvHtml5', | ||
22 | + ] | ||
23 | +}); |
app/main/templates/agents.html
1 | {% extends "base_page.html" %} | 1 | {% extends "base_page.html" %} |
2 | + | ||
3 | + | ||
4 | +{% block more_heads %} | ||
5 | + <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css"/> | ||
6 | + <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.7.0/css/buttons.dataTables.min.css"/> | ||
7 | + <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='lib/datatables-1.10.24/css/datatables.min.css') }}"/> | ||
8 | +{% endblock %} | ||
9 | + | ||
2 | {% block content %} | 10 | {% block content %} |
3 | 11 | ||
4 | <!-- Invisible span to definte wich ul and a in the navbar are actived --> | 12 | <!-- Invisible span to definte wich ul and a in the navbar are actived --> |
5 | <span id="nav_actived" style="display: none">agent,agents</span> | 13 | <span id="nav_actived" style="display: none">agent,agents</span> |
6 | 14 | ||
7 | -<table class="table table-hover"> | 15 | +<table id="table_datatables" class="table table-hover"> |
8 | <thead> | 16 | <thead> |
9 | <tr> | 17 | <tr> |
10 | <th scope="col">Nom</th> | 18 | <th scope="col">Nom</th> |
@@ -25,4 +33,9 @@ | @@ -25,4 +33,9 @@ | ||
25 | {% endfor %} | 33 | {% endfor %} |
26 | </tbody> | 34 | </tbody> |
27 | </table> | 35 | </table> |
28 | -{% endblock %} | ||
29 | \ No newline at end of file | 36 | \ No newline at end of file |
37 | +{% endblock %} | ||
38 | + | ||
39 | + | ||
40 | +{% block more_scripts %} | ||
41 | +{% include 'datatables-includes.html' %} | ||
42 | +{% endblock %} |
app/main/templates/projects.html
1 | {% extends "base_page.html" %} | 1 | {% extends "base_page.html" %} |
2 | + | ||
3 | +{% block more_heads %} | ||
4 | + <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css"/> | ||
5 | + <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.7.0/css/buttons.dataTables.min.css"/> | ||
6 | + <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='lib/datatables-1.10.24/css/datatables.min.css') }}"/> | ||
7 | +{% endblock %} | ||
8 | + | ||
2 | {% block content %} | 9 | {% block content %} |
3 | 10 | ||
4 | <!-- Invisible span to definte wich ul and a in the navbar are actived --> | 11 | <!-- Invisible span to definte wich ul and a in the navbar are actived --> |
5 | <span id="nav_actived" style="display: none">projet,projects</span> | 12 | <span id="nav_actived" style="display: none">projet,projects</span> |
6 | 13 | ||
7 | -<table class="table table-hover"> | 14 | +<table id="table_datatables" class="table table-hover"> |
8 | <thead> | 15 | <thead> |
9 | <tr> | 16 | <tr> |
10 | {% for c_title in projects[0][1:] %} | 17 | {% for c_title in projects[0][1:] %} |
@@ -28,3 +35,7 @@ | @@ -28,3 +35,7 @@ | ||
28 | </tbody> | 35 | </tbody> |
29 | </table> | 36 | </table> |
30 | {% endblock %} | 37 | {% endblock %} |
38 | + | ||
39 | +{% block more_scripts %} | ||
40 | +{% include 'datatables-includes.html' %} | ||
41 | +{% endblock %} |