From fdae6f3c1f6c831e5b08c800de67b1a151efdde0 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Tue, 3 Sep 2024 19:38:13 -0500 Subject: [PATCH] Fix sorting (with a bit of a hack) --- docs/_static/main.js | 29 +---------------------------- docs/conf.py | 10 +++------- docs/index.rst | 2 +- 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/docs/_static/main.js b/docs/_static/main.js index 368aeb91..5a0afe76 100644 --- a/docs/_static/main.js +++ b/docs/_static/main.js @@ -1,33 +1,6 @@ -$(document).ready( function () { +$(document).ready(function() { $('table.datatable').DataTable({ paging: false, searching: false, }); - - var tableInstance = $('table.centertable').DataTable({ - columnDefs: [{ - targets: '_all', - orderable: true - }], - order: [], - drawCallback: function() { - this.api().rows().nodes().to$().each(function(index) { - if (index < 6) - $(this).addClass('no-sort'); - }); - }, - paging: false, - searching: false, - }) - - tableInstance.on('order.dt', function() { - tableInstance.column(0).order('no-sort').draw(); - }); - - // Custom sorting behavior - $.fn.dataTable.ext.order['no-sort'] = function (_, _, dataIndex) { - if (dataIndex < 6) - return -1; // Force header and first 5 rows to be at the top - return 1; - }; }); diff --git a/docs/conf.py b/docs/conf.py index a7305130..6ea7076a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -79,15 +79,11 @@ html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] html_css_files = [ - 'https://cdn.datatables.net/2.1.5/css/jquery.dataTables.css', - 'https://cdn.datatables.net/fixedheader/4.0.1/css/fixedHeader.dataTables.css', + 'https://cdn.datatables.net/1.10.23/css/jquery.dataTables.min.css', 'style.css' ] html_js_files = [ - 'https://code.jquery.com/jquery-3.7.1.js', - 'https://cdn.datatables.net/2.1.5/js/dataTables.js', - 'https://cdn.datatables.net/fixedHeader/4.0.1/js/dataTables.fixedHeader.js', - 'https://cdn.datatables.net/fixedHeader/4.0.1/js/fixedHeader.dataTables.js', + 'https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js', 'main.js', ] @@ -146,7 +142,7 @@ # ('vb', 'visualbasic'), ] extlinks = { - 'prob': ('https://projecteuler.net/problem=%s', 'Problem #%s'), + 'prob': ('https://projecteuler.net/problem=%s', '\u200BProblem #%s'), 'source': ('https://github.com/LivInTheLookingGlass/Euler/blob/main/%s', 'here on GitHub!%.0s'), 'live-test': ('/_static/test-%s.html', 'click here!%.0s'), 'csref': ('https://learn.microsoft.com/en-us/dotnet/api/%s', '%s'), diff --git a/docs/index.rst b/docs/index.rst index fb25e7ec..4ca13236 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -61,7 +61,7 @@ Problems Solved +------+--------------------------------+ .. table:: - :class: centertable + :class: datatable centertable +-----------+------------+------------+------------+------------+------------+------------+------------+ | | |C| | |Cp| | |C#| | |Ja| | |Js| | |Py| | |Rs| |