Use DataTables in Mediawiki Table
Use DataTables in Mediawiki Table
Hello,
forgive me if I post a question to which there is an obvious answer, but I was not able to find an answer and get things working in my mediawiki for 2 days now. I'm using mediawiki v1.22 and would like to pimp all tables using DataTables the same way. I've installed DataTables and it is known to the RessourceManager (as in http://www.mediawiki.org/wiki/Extension:DataTables).
I now added this code to the Common.js (which is executed I checked with the alerts):
[code]
$(document).ready(function() {
/*alert("script loaded");*/
mw.loader.using( 'ext.datatables', function() {
/*alert("datatables loaded");*/
$('#example').dataTable( {
"sScrollX": "50%",
"sScrollXInner": "950%",
"bScrollCollapse": true,
} );
});
});
[/code]
But my table in a test wiki page
[code]
{| id="example"
|Orange
|Apfel
|-
|Brot
|Torte
|-
|Butter
|Eis
|}
[/code]
does not seem to be touched by DataTables. Is it because of missing thead/tbody support from mediawiki or am I missing something here ?
Thanks!
Chris
forgive me if I post a question to which there is an obvious answer, but I was not able to find an answer and get things working in my mediawiki for 2 days now. I'm using mediawiki v1.22 and would like to pimp all tables using DataTables the same way. I've installed DataTables and it is known to the RessourceManager (as in http://www.mediawiki.org/wiki/Extension:DataTables).
I now added this code to the Common.js (which is executed I checked with the alerts):
[code]
$(document).ready(function() {
/*alert("script loaded");*/
mw.loader.using( 'ext.datatables', function() {
/*alert("datatables loaded");*/
$('#example').dataTable( {
"sScrollX": "50%",
"sScrollXInner": "950%",
"bScrollCollapse": true,
} );
});
});
[/code]
But my table in a test wiki page
[code]
{| id="example"
|Orange
|Apfel
|-
|Brot
|Torte
|-
|Butter
|Eis
|}
[/code]
does not seem to be touched by DataTables. Is it because of missing thead/tbody support from mediawiki or am I missing something here ?
Thanks!
Chris
This discussion has been closed.
Replies
Allan
Mediawiki does unfortunetaly not support thead and tbody which is required by datatables. But since DataTables is very popular extension for Mediawiki, I thought there would be a way to get around this issue.
Chris
I recognize that scenario....