OLD | NEW |
(Empty) | |
| 1 (function () { |
| 2 var table = $("#results").dataTable({ |
| 3 serverSide: true, |
| 4 bFilter: false, |
| 5 "columns": [ |
| 6 { data: "filter" }, |
| 7 { data: "domain" }, |
| 8 { data: "hits" } |
| 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_by: ["filter", "domain", "hits"][sort[0]] + " " + sort[1] |
| 24 }, |
| 25 success: function(data, status, jqxhr) { |
| 26 callback({ |
| 27 draw: data.echo, |
| 28 recordsTotal: data.total, |
| 29 recordsFiltered: data.total, |
| 30 data: data.results |
| 31 }, status, jqxhr); |
| 32 } |
| 33 }); |
| 34 } |
| 35 }); |
| 36 |
| 37 $('#filter, #domain').keyup(function () { table.fnDraw(); }); |
| 38 }()); |
OLD | NEW |