Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: sitescripts/filterhits/static/query.js

Issue 4615801646612480: Issue 395 - Filter hits statistics backend (Closed)
Left Patch Set: Display friendly message if processing script can't connect to DB. Created March 2, 2015, 11:14 a.m.
Right Patch Set: Addressed further comments from Sebastian. Created April 2, 2015, 10:13 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/filterhits/static/query.html ('k') | sitescripts/filterhits/test/__init__.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 (function () { 1 (function () {
2 var table = $("#results").dataTable({ 2 var table = $("#results").dataTable({
3 serverSide: true, 3 serverSide: true,
4 bFilter: false, 4 bFilter: false,
5 "columns": [ 5 "columns": [
6 { data: "filter" }, 6 { data: "filter" },
7 { data: "domain" }, 7 { data: "domain" },
8 { data: "hits" } 8 { data: "frequency" }
9 ], 9 ],
10 order: [[2, "desc"]], 10 order: [[2, "desc"]],
11 fnServerData: function (source, data, callback, settings) { 11 fnServerData: function (source, data, callback, settings) {
12 var sort = settings.aaSorting[0]; 12 var sort = settings.aaSorting[0];
13 $.ajax({ 13 $.ajax({
14 dataType: "json", 14 dataType: "json",
15 type: "GET", 15 type: "GET",
16 url: "/query", 16 url: "/query",
17 data: { 17 data: {
18 echo: settings.iDraw, 18 echo: settings.iDraw,
19 skip: settings._iDisplayStart, 19 skip: settings._iDisplayStart,
20 take: settings._iDisplayLength, 20 take: settings._iDisplayLength,
21 filter: $('#filter').val(), 21 filter: $("#filter").val(),
22 domain: $('#domain').val(), 22 domain: $("#domain").val(),
23 order: sort[1], 23 order: sort[1],
24 order_by: ["filter", "domain", "hits"][sort[0]] 24 order_by: ["filter", "domain", "frequency"][sort[0]]
25 }, 25 },
26 success: function(data, status, jqxhr) { 26 success: function(data, status, jqxhr) {
27 callback({ 27 callback({
28 draw: data.echo, 28 draw: data.echo,
29 recordsTotal: data.total, 29 recordsTotal: data.total,
30 recordsFiltered: data.total, 30 recordsFiltered: data.total,
31 data: data.results 31 data: data.results
32 }, status, jqxhr); 32 }, status, jqxhr);
33 } 33 }
34 }); 34 });
35 } 35 }
36 }); 36 });
37 37
38 $('#filter, #domain').keyup(function () { table.fnDraw(); }); 38 $("#filter, #domain").on("input", function () { table.fnDraw(); });
39 }()); 39 }());
LEFTRIGHT

Powered by Google App Engine
This is Rietveld