TableTools and Mediawiki 1.20.2

TableTools and Mediawiki 1.20.2

lloonngglloonngg Posts: 1Questions: 0Answers: 0
edited October 2013 in TableTools
Hi,

I have been able to implement DataTables 1.9.4 in Mediawiki with some help from Daniel Renfro, the developer of the extension version for mediawiki. The implementation requires the TableMarkerUpper extension which is part of the TableEdit extension (https://www.mediawiki.org/wiki/Extension:TableEdit). To load DataTables as a resource in MW, I put the following script on the Mediawiki:Common.js page:

$(document).ready(function() {
mw.loader.using( 'ext.datatables', function() {
$('.dataTable').dataTable( {
} );
});
});

That will render any data table with the class="dataTable" on a wiki page. I thought I would share this info for those also struggling to get this to work.

Now what I need help with is how to implement TableTools. I have tried both the basic initialization and alternative code without success. There are no errors when I check Firebug or the Chrome console. The CSV, Excel, PDF, Copy buttons do not show up. I also cannot get any of the other plugins in the extras folder to show up.

These are some codes I have tried:

Attempt1:

$(document).ready(function() {
mw.loader.using( 'ext.datatables', function() {
$('.dataTable').dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "media/swf/copy_csv_xls_pdf.swf"}
} );
});
});


Attempt2:

$(document).ready(function() {
mw.loader.using( 'ext.tabletools', function() {


var oTable = $('.dataTable').dataTable();
var oTableTools = new TableTools( oTable, {
"buttons": [
"copy",
"csv",
"xls",
"pdf",
{ "type": "print", "buttonText": "Print me!" }
]
} );

$('.dataTable').before( oTableTools.dom.container );
});
});

No success either way. I was able to manipulate "sDom" to move the buttons around but it appears that TableTools may not be called correctly from the extras folder? Unfortunately, our wiki is a private one so I can't share our system publicly. TableTools is so awesome and it would be great to get full functionality out of the plugins. Any help would be appreciated from anyone who has figured this out for Mediawiki.

Thanks,

Long

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Looks like it should work. I think we'd need a link to a test case to know what is going wrong.

    Allan
This discussion has been closed.