MediaWiki:Datatables custom.js: Difference between revisions
From Comprehensible Input Wiki
Content added Content deleted
m (Dimpizzy moved page User:Dimpizzy/datatables custom.js to MediaWiki:Datatables custom.js without leaving a redirect) |
No edit summary |
||
Line 6: | Line 6: | ||
// Activate DataTable |
// Activate DataTable |
||
var waitForDT = setInterval(function () { |
|||
⚫ | |||
if (typeof $('#library').dataTable === 'function') { |
|||
⚫ | |||
⚫ | |||
⚫ | |||
] |
|||
⚫ | |||
⚫ | |||
⚫ | |||
] |
|||
} ); |
|||
clearInterval(waitForDT); |
|||
} |
|||
⚫ | |||
}); |
}); |
Revision as of 03:27, 5 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');
// Activate DataTable
var waitForDT = setInterval(function () {
if (typeof $('#library').dataTable === 'function') {
$('#library').dataTable( {
"columnDefs": [
{ "orderData": 4, "targets": 2 }
]
} );
clearInterval(waitForDT);
}
}, 10);
});