MediaWiki:Datatables custom.js: Difference between revisions

From Comprehensible Input Wiki
Content added Content deleted
No edit summary
No edit summary
Line 1: Line 1:
$(document).ready( function () {
$(document).ready( function () {
// Create <thead> for DataTables to work
var header = document.getElementById('library').createTHead().id = 'lib-thead';
jQuery('#lib-header').detach().appendTo('#lib-thead');
document.getElementById('tableHolder').style.display='block';


// Activate DataTable
// Activate DataTable
var waitForDT = setInterval(function () {
var waitForDT = setInterval(function () {
if (typeof $('#library').dataTable === 'function' & document.getElementById('tableHolder')) {
if (typeof $('#library').dataTable === 'function' & document.getElementById('tableHolder')) {
// Create <thead> for DataTables to work
var header = document.getElementById('library').createTHead().id = 'lib-thead';
jQuery('#lib-header').detach().appendTo('#lib-thead');
document.getElementById('tableHolder').style.display='block';





Revision as of 01:09, 7 February 2023

$(document).ready( function () {
	
// Create <thead> for DataTables to work
var header = document.getElementById('library').createTHead().id = 'lib-thead';
jQuery('#lib-header').detach().appendTo('#lib-thead');
document.getElementById('tableHolder').style.display='block';

// Activate DataTable
var waitForDT = setInterval(function () {
    if (typeof $('#library').dataTable === 'function' & document.getElementById('tableHolder')) {


        $('#library').dataTable( {
          "columnDefs": [
          { "orderData": 4, "targets": 2 }
          ]
        } );


        clearInterval(waitForDT);
    }
}, 100);

});