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

Side by Side Diff: sitescripts/filterhits/static/query.js

Issue 4615801646612480: Issue 395 - Filter hits statistics backend (Closed)
Patch Set: Addressed further comments from Wladimir. Created March 27, 2015, 10:12 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 (function () {
2 var table = $("#results").dataTable({
3 serverSide: true,
4 bFilter: false,
5 "columns": [
6 { data: "filter" },
7 { data: "domain" },
8 { data: "frequency" }
9 ],
10 order: [[2, "desc"]],
11 fnServerData: function (source, data, callback, settings) {
12 var sort = settings.aaSorting[0];
13 $.ajax({
14 dataType: "json",
15 type: "GET",
16 url: "/query",
17 data: {
18 echo: settings.iDraw,
19 skip: settings._iDisplayStart,
20 take: settings._iDisplayLength,
21 filter: $('#filter').val(),
22 domain: $('#domain').val(),
23 order: sort[1],
24 order_by: ["filter", "domain", "frequency"][sort[0]]
25 },
26 success: function(data, status, jqxhr) {
27 callback({
28 draw: data.echo,
29 recordsTotal: data.total,
30 recordsFiltered: data.total,
31 data: data.results
32 }, status, jqxhr);
33 }
34 });
35 }
36 });
37
38 $('#filter, #domain').on('input', function () { table.fnDraw(); });
Wladimir Palant 2015/03/28 12:59:19 Style nit: Double quotation marks in JavaScript pl
kzar 2015/03/28 14:11:56 Done.
39 }());
OLDNEW

Powered by Google App Engine
This is Rietveld