Use DataTables in Mediawiki Table

Use DataTables in Mediawiki Table

kikmannkikmann Posts: 3Questions: 0Answers: 0
edited November 2013 in General
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

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Does MediaWiki create an HTML table which matches DataTables prerequisites: http://datatables.net/usage/#prerequisites ?

    Allan
  • kikmannkikmann Posts: 3Questions: 0Answers: 0
    edited November 2013
    Hi 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
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    @Chris - I might need this myself one day - have you asked the Mediawiki extension people about it?
  • kikmannkikmann Posts: 3Questions: 0Answers: 0
    No, not yet. Since DT is a popular extension to MW, I assumed this to work somehow and me to be to dumb to find out :)
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    [quote]I assumed this to work somehow and me to be to dumb to find out [/quote]
    I recognize that scenario....
This discussion has been closed.