gui: Add the ability to filter the Add Indexer datatable (#11596)

This commit is contained in:
Wayne Dupree
2021-04-24 01:45:33 -05:00
committed by GitHub
parent e1aa849315
commit 62de0458e5
2 changed files with 34 additions and 2 deletions

View File

@@ -266,6 +266,32 @@ function displayUnconfiguredIndexersList() {
});
indexersTable.find("table").DataTable(
{
initComplete: function () {
this.api().columns().every(function () {
var column = this;
var headerText = column.header().innerText;
if (headerText == 'Language') {
var select = $('<select><option value="">Show all</option></select>')
.appendTo($(column.footer()).empty())
.on('change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
column.data().unique().sort().each(function (d, j) {
select.append('<option value="' + d + '">' + d + '</option>')
});
} else {
$(column.footer()).empty();
}
});
},
"stateSave": true,
"stateDuration": 0,
"fnStateSaveParams": function (oSettings, sValue) {
@@ -1022,6 +1048,7 @@ function bindUIButtons() {
$('#jackett-add-indexer').click(function () {
$("#modals").empty();
displayUnconfiguredIndexersList();
$('#unconfigured-indexer-datatable tfoot tr').insertAfter($('#unconfigured-indexer-datatable thead tr'));
});
$("#jackett-test-all").click(function () {