Customized Buttons using Flash doesn't work - only printing works???

Customized Buttons using Flash doesn't work - only printing works???

MichaelLandMichaelLand Posts: 26Questions: 0Answers: 0
edited June 2012 in General
Hello, I have installed installed Adobe Flash into my development environment and tested DataTable examples considering customized buttons online and they seems to work. But when I try to do it in my code it does not work. I have checked Online Samples code using View Source but noticed nothing.

I have tried both Copy to Clipboard and PDF file creating but nothing works. Like you see code below I use Customized buttons because I want to localize them. Printing works well but I have understood that it is only part that does not use Flash.

I include following files
TableTools.css
jquery.dataTables.js
TableTools.js
ZeroClipboard.js

and get no error messages.

What could be wrong, thanks
Michael




// I'm using DataTables-1.9.0 and it's TableTools
$(document).ready(function () {

var datatable = $('#GeneratedReport').dataTable({
"iDisplayLength": 25,
"aLengthMenu": [[25, 50, 100, 500, 1000, 5000, -1], [25, 50, 100, 500, 1000, 5000, 'All']],
"aaSorting": [[0, "asc"]],
"oLanguage": { // Language FI
"sProcessing": "Hetkinen...",
"sLengthMenu": "Näytä kerralla _MENU_ riviä",
"sZeroRecords": "Tietoja ei löytynyt",
"sInfo": "Näytetään rivit _START_ - _END_ (yhteensä _TOTAL_ )",
"sInfoEmpty": "Näytetään 0 - 0 (yhteensä 0)",
"sInfoFiltered": "(suodatettu _MAX_ tuloksen joukosta)",
"sInfoPostFix": "",
"sSearch": "Etsi:",
"sUrl": "",
"oPaginate": { "sFirst": "Ensimmäinen", "sPrevious": "Edellinen ", "sNext": "Seuraava ", "sLast": "Viimeinen" },
"aoColumns": [
null, null, null, null, null, null, null, null, null, { "bSortable": false }
]
},
"sDom": 'l<"H"frT>t<"F"ip>',
"oTableTools": {
"aButtons": [ // !!!! Localized buttons !!!!
{
"sExtends": "copy",
"sButtonText": "Kopioi leikepöydälle",
"sToolTip": "Leikepöydälle",
"sInfo": "Kopioidaan taulukkoa leikepöydälle." + "Odota hetki."
},
{
"sExtends": "print",
"sButtonText": "Tulosta",
"sToolTip": "Tulostusnäkymä",
"sInfo": "Tulostusnäkymää muodostetaan." + "Paluu edelliselle näytölle ESC-näppäimellä."
}
]
}
});
});

Replies

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    Sounds like the SWF file isn't loading. Is your server error log showing any 404 errors? Failing that, we'd need a link to a test case showing the problem.

    Allan
  • MichaelLandMichaelLand Posts: 26Questions: 0Answers: 0
    Hello,

    I didn't find any error messages.
    I'm running Application in Visual Studio's WebApp.DevServer.

    Customized buttons have icons with buttontext defined in code.
    But like I mentioned copy, pdf, xls aren't working. Printing works.

    When using Customized buttons should .swf file also be defined and loaded?

    Michael
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    Try setting the SWF path like this: http://datatables.net/release-datatables/extras/TableTools/swf_path.html . If that doesn't work, then we'll need a link to a test case please.

    Allan
  • MichaelLandMichaelLand Posts: 26Questions: 0Answers: 0
    Hello,

    I tried the whole path from WebApplication removing step by step one hierarchy starting from the most highest level like below:

    ASP.NET MVC3 WebApplication-Solution

    "sSwfPath": "Content/DataTables-1.9.0/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"

    then

    "sSwfPath": DataTables-1.9.0/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"

    etc.

    But the same problem exixts whitout any errors.

    Michael
  • MichaelLandMichaelLand Posts: 26Questions: 0Answers: 0
    edited June 2012
    BTW: Does ASP.NET MVC3 based WebApplication need someting else than plain DataTables/TableTools Plugins if Application uses Flash like DataTabels does in Buttons?

    Michael

    PS. Adobe Flash Add-On is installed to browser.
  • MichaelLandMichaelLand Posts: 26Questions: 0Answers: 0
    edited June 2012
    Okei, now I got a message from Chrome DevTools
    GET http://localhost:49246/media/swf/copy_cvs_xls_pdf.swf 404 (Not Found)

    So, where copy_cvs_xls_pdf.swf should be placed and configured...
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin
    The swf file can be put anywhere you want on your server. At the moment it is looking for it in "/media/swf/copy_cvs_xls_pdf.swf" so you could put it there...

    Allan
  • MichaelLandMichaelLand Posts: 26Questions: 0Answers: 0
    So, what I did was following:

    I created a directory Content under my WebApplication and there I copied
    file copy_csv_xls_pdf.swf

    BUT in Javascript file where I initialize DataTables Table I configure
    variable sSwfPath to tell *MY* Web Application where that Flash file (.swf) is.

    So, if file is in Web Application's directory Content I configure sSwfPath like this:

    "sSwfPath": "Content/copy_csv_xls_pdf.swf",

    Cheers,

    Michael
This discussion has been closed.