Skip to content

Commit

Permalink
Merge pull request #130 from opensafely-core/fast-csv
Browse files Browse the repository at this point in the history
Faster csv rendering
  • Loading branch information
bloodearnest authored Mar 4, 2024
2 parents 0b201b9 + ee91ffe commit 3dd31fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
39 changes: 18 additions & 21 deletions airlock/templates/file_browser/csv.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
{% load airlocktags %}
{% as_csv_data contents as csv_data %}
<div class="inline-block min-w-full align-middle max-w-full">
{% #table %}
{% #table_head class="bg-slate-200" id="csvTable" %}
{% #table_row %}
{% for header in csv_data.headers %}
{% #table_header %}{{ header }}{% /table_header %}
{% endfor %}
{% /table_row %}
{% /table_head %}

{% #table_body %}
{% for row in csv_data.rows %}
{% #table_row class="even:bg-slate-50" %}
{% for cell in row %}
{% #table_cell %}
{{ cell }}
{% /table_cell %}
{% endfor %}
{% /table_row %}
<table class="datatable">
<thead class="bg-slate-200" id="csvTable">
<tr>
{% for header in csv_data.headers %}
<th>{{ header }}</th>
{% endfor %}
{% /table_body %}
{% /table %}
</div>
</tr>
</thead>
<tbody>
{% for row in csv_data.rows %}
<tr class="even:bg-slate-50">
{% for cell in row %}
<td>{{ cell }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
6 changes: 6 additions & 0 deletions airlock/templates/file_browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
overflow: scroll;
}

.datatable thead {
position: sticky;
top: 0;
}


</style>
{% endblock extra_styles %}

Expand Down

0 comments on commit 3dd31fc

Please sign in to comment.