Integrate datatables.net
[docs.git] / docs / ext / odl-jira.py
index 400eba8932394a6f67b19dfd05e7bdda199828e7..7ca7ed6d6e73cee5d6c6e024d2b39a7a193ca7cd 100644 (file)
@@ -46,7 +46,6 @@ class JiraFixedIssuesDirective(Directive):
         # FIXME: this is not quite nice: can we emit the table markup directly
         table = [
             '.. list-table:: Issues resolved in versions %s through %s' % (from_ver, to_ver),
-            # FIXME: bind to https://datatables.net/
             '   :class: datatable',
             '   :header-rows: 1',
             '   :widths: auto',
@@ -112,7 +111,6 @@ class JiraKnownIssuesDirective(Directive):
         # FIXME: this is not quite nice: can we emit the table markup directly
         table = [
             '.. list-table:: Issues affecting versions %s through %s' % (from_ver, to_ver),
-            # FIXME: bind to https://datatables.net/
             '   :class: datatable',
             '   :header-rows: 1',
             '   :widths: auto',
@@ -167,6 +165,11 @@ def setup(app):
     app.add_directive('jira_fixed_issues', JiraFixedIssuesDirective)
     app.add_directive('jira_known_issues', JiraKnownIssuesDirective)
 
+    # https://datatables.net/ improvements to tables
+    app.add_css_file("https://cdn.datatables.net/1.11.2/css/jquery.dataTables.min.css")
+    app.add_js_file("https://cdn.datatables.net/1.11.2/js/jquery.dataTables.min.js")
+    app.add_js_file(None, **{"body": "$(document).ready( function () { $('table.datatable').DataTable(); } );", "type": "text/javascript", "class": "init"})
+
     return {
         'version': '0.1',
         'parallel_read_safe': True,