The two DT/TT config/initalization alternatives behaving differently?

The two DT/TT config/initalization alternatives behaving differently?

steinarksteinark Posts: 7Questions: 1Answers: 0

I have just started upgrading an old DT application to use the newest stable release, and at the same time I am upgrading jQuery and moving from Jquery UI to Bootstrap. Rather than migrating my old config, I am starting from scratch to build the interface and pull all libraries and CSS from CDNs, paying attention to using correct versions, and with config and initialization based on DT/TT/Bootstrap examples. I am using DT 1.10.5 and TT 2.2.3 and jQuery 1.11.1.

Most basic things are working, including Bootstrap styling, localization and more. But I am struggling with getting the TT buttons to work. Of course, this is one of the most common problems and questions asked, but I can't seem to identifiy exactly what I am doing wrong. But trying different things, I see some strange behavior. My first question is, what is the difference by doing

var DT = $('#statbyorg').DataTable({
        .......
       "tableTools": {
            "sSwfPath": "http://cdn.datatables.net/tabletools/2.2.3/swf/copy_csv_xls.swf",
            "aButtons": [ ... ]
      }
 });
var TT = new $.fn.dataTable.TableTools( DT);
$( TT.fnContainer() ).insertBefore('div.dataTables_wrapper');

and

var DT = $('#statbyorg').DataTable({
        .......
});
var TT = new $.fn.dataTable.TableTools( DT, {
    "sSwfPath": "http://cdn.datatables.net/tabletools/2.2.3/swf/copy_csv_xls.swf",
            "aButtons": [ ... ]
});
$( TT.fnContainer() ).insertBefore('div.dataTables_wrapper');

I have seen both ways used in examples, but in my case, the second approach does not work. Neither the SWF file is picked up nor the customized buttons.

But in the first case, the SWF file is apparently picked up since the 404 error in the JS console is gone, but nothing happens when clicking the Excel or PDF button I am using. In addition, the interface hangs. Nothing is seen in the console (started by F12 in Chrome).

My application is behind Basic Auth, would this cause a problem with the SWF file hosted externally? Another thing, if I try to grab the SWF file from bash using "GET", I get an HTML error message saying:

The owner of this website (cdn.datatables.net) has banned your access based on your browser's signature (1c249828a24b06ee-ua24)

I am in Amazon AWS. Could this be the problem also when the request is sent from Chrome, not from bash?

This discussion has been closed.