MediaWiki:Datatables custom.js: Difference between revisions

From Comprehensible Input Wiki
Content added Content deleted
No edit summary
Tag: Manual revert
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');


// Activate DataTable
// Activate DataTable
var waitForDT = setInterval(function () {
var waitForDT = setInterval(function () {
if (typeof $('#library').dataTable === 'function') {
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';



$('#library').dataTable( {
$('#library').dataTable( {
Line 18: Line 20:
clearInterval(waitForDT);
clearInterval(waitForDT);
}
}
}, 10);
}, 100);


});
});

Revision as of 00:31, 7 February 2023

$(document).ready( function () {

// Activate DataTable
var waitForDT = setInterval(function () {
    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';


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


        clearInterval(waitForDT);
    }
}, 100);

});