MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
}); | }); | ||
}); | }); | ||
$(document).ready(function () { | |||
var table = $('#example').DataTable(); | |||
// Spaltensuche aktivieren | |||
$('#example thead tr:eq(1) th').each(function (i) { | |||
$('input', this).on('keyup change', function () { | |||
if (table.column(i).search() !== this.value) { | |||
table.column(i).search(this.value).draw(); | |||
} | |||
}); | |||
}); | |||
}); |
Revision as of 01:57, 25 June 2025
// DataTables CSS laden mw.loader.load('https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css', 'text/css'); // JS laden und initialisieren nach vollständigem Seitenaufbau mw.loader.getScript('https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js') .then(function () { $(function () { var table = document.getElementById('illust-table'); if (table) { console.log('Initialisiere DataTables für #illust-table …'); $('#illust-table').DataTable(); } else { console.warn('Tabelle mit ID "illust-table" nicht gefunden.'); } }); }); $(document).ready(function () { var table = $('#example').DataTable(); // Spaltensuche aktivieren $('#example thead tr:eq(1) th').each(function (i) { $('input', this).on('keyup change', function () { if (table.column(i).search() !== this.value) { table.column(i).search(this.value).draw(); } }); }); });