Add datatables tools to ticket reports
This commit is contained in:
parent
64f9b3fb6c
commit
45512e815a
4 changed files with 62 additions and 28 deletions
|
@ -18,23 +18,52 @@
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
{% for report in reports %}
|
{% for report in reports %}
|
||||||
<h3>{{ report.title }}</h3>
|
<h3>{{ report.title }}</h3>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped table-reportdata">
|
||||||
<tr>
|
<thead>
|
||||||
{% for heading in report.headings %}
|
<tr>
|
||||||
<th>{{ heading }}</th>
|
{% for heading in report.headings %}
|
||||||
{% endfor %}
|
<th>{{ heading }}</th>
|
||||||
</tr>
|
{% endfor %}
|
||||||
{% for line in report.rows %}
|
</tr>
|
||||||
<tr>
|
</thead>
|
||||||
{% for item in line %}
|
<tbody>
|
||||||
<td>
|
{% for line in report.rows %}
|
||||||
{{ item|safe }}
|
<tr>
|
||||||
</td>
|
{% for item in line %}
|
||||||
|
<td>
|
||||||
|
{{ item|safe }}
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tbody>
|
||||||
{% endfor %}
|
</table>
|
||||||
</table>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extra_script %}
|
||||||
|
<script src="{{ STATIC_URL }}datatables/js/jquery.dataTables.min.js" type="text/javascript"></script>
|
||||||
|
<script src="{{ STATIC_URL }}tabletools/js/TableTools.min.js" type="text/javascript"></script>
|
||||||
|
<script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.js" type="text/javascript"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
$("table.table-reportdata").dataTable({
|
||||||
|
"sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>",
|
||||||
|
"sPaginationType": "bootstrap",
|
||||||
|
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
|
||||||
|
"bStateSave": true,
|
||||||
|
"oTableTools": {
|
||||||
|
"aButtons": [
|
||||||
|
"copy",
|
||||||
|
"csv",
|
||||||
|
"print"
|
||||||
|
],
|
||||||
|
"sSwfPath": "{{ STATIC_URL }}tabletools/swf/copy_csv_xls.swf"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
"sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>",
|
"sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>",
|
||||||
"sPaginationType": "bootstrap",
|
"sPaginationType": "bootstrap",
|
||||||
"bStateSave": true,
|
"bStateSave": true,
|
||||||
|
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
|
||||||
"oTableTools": {
|
"oTableTools": {
|
||||||
"aButtons": [
|
"aButtons": [
|
||||||
"copy",
|
"copy",
|
||||||
|
|
|
@ -108,19 +108,19 @@
|
||||||
<script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.js" type="text/javascript"></script>
|
<script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.js" type="text/javascript"></script>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$("table.table-reportdata").each(function () {
|
||||||
$(".tip").tooltip();
|
$(this).dataTable({
|
||||||
$("table.table-reviews").dataTable({
|
"sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>",
|
||||||
"sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>",
|
|
||||||
"sPaginationType": "bootstrap",
|
"sPaginationType": "bootstrap",
|
||||||
"bStateSave": true,
|
"bStateSave": true,
|
||||||
|
"aLengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]],
|
||||||
"oTableTools": {
|
"oTableTools": {
|
||||||
"aButtons": [
|
"aButtons": [
|
||||||
"copy",
|
"copy",
|
||||||
"csv",
|
"csv",
|
||||||
"print"
|
"print"
|
||||||
],
|
],
|
||||||
"sSwfPath": "{{ STATIC_URL }}tabletools/swf/copy_csv_xls.swf"
|
"sSwfPath": "{{ STATIC_URL }}tabletools/swf/copy_csv_xls.swf"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,12 +34,15 @@
|
||||||
<h3 class="panel-title">{{ report.title }}</h3>
|
<h3 class="panel-title">{{ report.title }}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped table-reportdata">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{% for heading in report.headings %}
|
{% for heading in report.headings %}
|
||||||
<th>{{ heading }}</th>
|
<th>{{ heading }}</th>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
{% for line in report.rows %}
|
{% for line in report.rows %}
|
||||||
<tr>
|
<tr>
|
||||||
{% for item in line %}
|
{% for item in line %}
|
||||||
|
@ -48,7 +51,8 @@
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue