From b18a11994ba774201ea0e1aedc506fe614fe6ff3 Mon Sep 17 00:00:00 2001
From: Te Hung Tseng <te-hung.tseng@ess.eu>
Date: Fri, 26 Mar 2021 10:24:54 +0100
Subject: [PATCH] added javascript for datatable pagination and search function
 for history variable table

---
 app/static/js/history.js | 13 +++++++++++++
 app/templates/base.html  |  1 +
 2 files changed, 14 insertions(+)
 create mode 100644 app/static/js/history.js

diff --git a/app/static/js/history.js b/app/static/js/history.js
new file mode 100644
index 0000000..bf0e2ce
--- /dev/null
+++ b/app/static/js/history.js
@@ -0,0 +1,13 @@
+$(document).ready(function () {
+    $("#host_version_table").DataTable({
+        "lengthMenu": [[1, 5, 10, 25, -1], [1, 5, 10, 25, "All"]],
+        "order": [[1, "desc"]]
+    });
+});
+
+$(document).ready(function () {
+    $("#group_version_table").DataTable({
+        "lengthMenu": [[1, 5, 10, 25, -1], [1, 5, 10, 25, "All"]],
+        "order": [[1, "desc"]]
+    });
+});
diff --git a/app/templates/base.html b/app/templates/base.html
index 6025517..2cca31c 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -78,6 +78,7 @@
   <script type=text/javascript>
     $SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
   </script>
+  <script src="{{ url_for('static', filename='js/history.js') }}"></script>
   <script src="{{ url_for('static', filename='js/csentry.js') }}"></script>
   {% block csentry_scripts %}{% endblock %}
 {% endblock %}
-- 
GitLab