Commit b3cb00e4c13e8b3560c35eab299aaf5f27418a96

Authored by Anais Amato
Committed by hitier
1 parent 715c0527

Make tables exportables

app/main/static/js/style_tables.js
@@ -2,5 +2,10 @@ $('#charge_table').DataTable({ @@ -2,5 +2,10 @@ $('#charge_table').DataTable({
2 "paginate": false, 2 "paginate": false,
3 "searching": true, 3 "searching": true,
4 "ordering": true, 4 "ordering": true,
5 - "info": false 5 + "info": false,
  6 + "dom": 'Bfrtip',
  7 + buttons: [
  8 + 'excelHtml5',
  9 + 'csvHtml5',
  10 + ]
6 }); 11 });
app/main/templates/agent.html
1 {% extends "base_page.html" %} 1 {% extends "base_page.html" %}
2 2
3 {% block more_heads %} 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"/>
4 <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='lib/datatables-1.10.24/css/datatables.min.css') }}"/> 6 <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='lib/datatables-1.10.24/css/datatables.min.css') }}"/>
5 <link href="{{ url_for('main.static', filename='css/charges.css', version=config.VERSION) }}" rel="stylesheet" 7 <link href="{{ url_for('main.static', filename='css/charges.css', version=config.VERSION) }}" rel="stylesheet"
6 type="text/css"/> 8 type="text/css"/>
app/main/templates/project.html
1 {% extends "base_page.html" %} 1 {% extends "base_page.html" %}
2 2
3 {% block more_heads %} 3 {% block more_heads %}
4 -<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='lib/datatables-1.10.24/css/datatables.min.css') }}"/>  
5 -<link href="{{ url_for('main.static', filename='css/charges.css', version=config.VERSION) }}" rel="stylesheet" type="text/css"/> 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 + <link href="{{ url_for('main.static', filename='css/charges.css', version=config.VERSION) }}" rel="stylesheet" type="text/css"/>
6 {% endblock %} 8 {% endblock %}
7 9
8 {% block content %} 10 {% block content %}
app/static/css/style.css
@@ -113,6 +113,7 @@ dl.agent { @@ -113,6 +113,7 @@ dl.agent {
113 line-height: 1.2; 113 line-height: 1.2;
114 } 114 }
115 115
  116 +/* Datatables modifications */
116 .dataTables_wrapper { 117 .dataTables_wrapper {
117 margin-top: 50px; 118 margin-top: 50px;
118 } 119 }
@@ -130,4 +131,8 @@ table.dataTable thead .sorting_desc_disabled{ @@ -130,4 +131,8 @@ table.dataTable thead .sorting_desc_disabled{
130 131
131 .dataTables_filter { 132 .dataTables_filter {
132 float: left !important; 133 float: left !important;
  134 +}
  135 +
  136 +.dt-buttons {
  137 + float: right !important;
133 } 138 }
134 \ No newline at end of file 139 \ No newline at end of file
app/templates/bs4-scripts.html
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}" type="text/javascript"></script> 2 <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}" type="text/javascript"></script>
3 <script> 3 <script>
4 $(function () { 4 $(function () {
5 - $('[data-toggle="tooltip"]').tooltip()  
6 - }) 5 + $('[data-toggle="tooltip"]').tooltip()
  6 + });
7 7
8 // Set the bootstrap layout for forms 8 // Set the bootstrap layout for forms
9 $(".pdc-form").addClass("col-12 col-md-10 col-lg-8 col-xl-6") 9 $(".pdc-form").addClass("col-12 col-md-10 col-lg-8 col-xl-6")
app/templates/datatables-includes.html
1 <script src="{{ url_for('static', filename='lib/datatables-1.10.24/js/datatables.min.js') }}" type="text/javascript"></script> 1 <script src="{{ url_for('static', filename='lib/datatables-1.10.24/js/datatables.min.js') }}" type="text/javascript"></script>
  2 +
  3 +<script type="text/javascript" src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
  4 +<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.0/js/dataTables.buttons.min.js"></script>
  5 +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
  6 +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
  7 +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
  8 +<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.7.0/js/buttons.html5.min.js"></script>
  9 +
2 <script src="{{ url_for('main.static', filename='js/style_tables.js') }}" type="text/javascript"></script> 10 <script src="{{ url_for('main.static', filename='js/style_tables.js') }}" type="text/javascript"></script>