Skip to content

Commit

Permalink
Merge pull request #292 from ELIXIR-Belgium/datatable-query
Browse files Browse the repository at this point in the history
Add searchBuilder option for DataTables
  • Loading branch information
bedroesb authored Nov 20, 2024
2 parents bb9a90a + bdd92e2 commit 329c584
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ theme_variables:
# edit_me: true
# open_issue: true
# history: true
# datatables:
# searchbuilder: True
# headings:
# related-pages: Related pages
# more-information-tiles: More information
Expand Down
14 changes: 13 additions & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,25 @@
<link rel="stylesheet" type="text/css" href="{{ 'assets/css/dataTables.bootstrap5.min.css' | relative_url }}">
<script type="text/javascript" charset="utf8" src="{{ 'assets/js/jquery.dataTables.min.js' | relative_url }}"></script>
<script type="text/javascript" charset="utf8" src="{{ 'assets/js/dataTables.bootstrap5.min.js' | relative_url }}"></script>
{%- if site.theme_variables.datatables.searchbuilder %}
<link rel="stylesheet" type="text/css" href="{{ 'assets/css/dataTables.dateTime.min.css' | relative_url }}">
<link rel="stylesheet" type="text/css" href="{{ 'assets/css/searchBuilder.bootstrap5.min.css' | relative_url }}">
<script type="text/javascript" charset="utf8" src="{{ 'assets/js/dataTables.searchBuilder.min.js' | relative_url }}"></script>
<script type="text/javascript" charset="utf8" src="{{ 'assets/js/dataTables.dateTime.min.js' | relative_url }}"></script>
<script type="text/javascript" charset="utf8" src="{{ 'assets/js/searchBuilder.bootstrap5.min.js' | relative_url }}"></script>
{%- endif %}
<script type="text/javascript">
$(document).ready(function () {
$('table.display').each(function() {
$(this).DataTable({
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
stateSave: true,
searching: true,
{%- if site.theme_variables.datatables.searchbuilder %}
layout: {
top1Start: 'searchBuilder'
},
{%- endif %}
info: true,
pageLength: 10,
language: {
Expand All @@ -82,7 +94,7 @@
$('#'+tableId+'_wrapper .dt-search').hide();
$('#'+tableId+'_wrapper .dt-info').hide();
}
$('.dt-layout-full').addClass('table-responsive');
$('.dt-layout-table .dt-layout-full').addClass('table-responsive');
}
});
})
Expand Down
1 change: 1 addition & 0 deletions assets/css/dataTables.dateTime.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/css/searchBuilder.bootstrap5.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions assets/js/dataTables.dateTime.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions assets/js/dataTables.searchBuilder.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions assets/js/searchBuilder.bootstrap5.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pages/documentation/configuring_theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ theme_variables:
edit_me: true
open_issue: true
history: true
datatables:
searchbuilder: False
headings:
related-pages: Related pages
more-information-tiles: More information
Expand Down Expand Up @@ -83,6 +85,8 @@ More detailed information about these settings can be found here:
* `edit_me`: Enable the 'propose an edit on this page' button.
* `open_issue`: Enable the 'open an issue on this page' button.
* `history`: Enable the 'history of this page' button.
* **datatables**: Settings related to the DataTables JS library
* `searchbuilder`: SearchBuilder provides the end user with an easy to use UI for them to create their own complex custom search expression for a DataTable. Default: False.
* **headings**: Change the subtitles or collapse the page sections that are automatically generated
`related-pages`: Default: Related pages
`more-information-tiles`: Default: More information
Expand Down

0 comments on commit 329c584

Please sign in to comment.