Index: sitescripts/filterhits/static/query.js |
diff --git a/sitescripts/filterhits/static/query.js b/sitescripts/filterhits/static/query.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ca40789f6de998b4ba65e2d181720d56bd55fd4c |
--- /dev/null |
+++ b/sitescripts/filterhits/static/query.js |
@@ -0,0 +1,38 @@ |
+(function () { |
+ var table = $("#results").dataTable({ |
+ serverSide: true, |
+ bFilter: false, |
+ "columns": [ |
+ { data: "filter" }, |
+ { data: "domain" }, |
+ { data: "hits" } |
+ ], |
+ order: [[2, "desc"]], |
+ fnServerData: function (source, data, callback, settings) { |
+ var sort = settings.aaSorting[0]; |
+ $.ajax({ |
+ dataType: "json", |
+ type: "GET", |
+ url: "/query", |
+ data: { |
+ echo: settings.iDraw, |
+ skip: settings._iDisplayStart, |
+ take: settings._iDisplayLength, |
+ filter: $('#filter').val(), |
+ domain: $('#domain').val(), |
+ order_by: ["filter", "domain", "hits"][sort[0]] + " " + sort[1] |
+ }, |
+ success: function(data, status, jqxhr) { |
+ callback({ |
+ draw: data.echo, |
+ recordsTotal: data.total, |
+ recordsFiltered: data.total, |
+ data: data.results |
+ }, status, jqxhr); |
+ } |
+ }); |
+ } |
+ }); |
+ |
+ $('#filter, #domain').keyup(function () { table.fnDraw(); }); |
+}()); |