0

We're using the excellent jQuery Datatables plug-in with TableTools for bulk actions such as copy and export to CSV. These require Flash, but we are serving many customers that don't have flash enabled. Right now they appear broken for this audience, as the "missing plugin" note appears over the button text. I'd rather hide the buttons but I'm not sure how.

Does anybody know how I can set up these buttons to be hidden if flash is not enabled?

Nikola K.
  • 7,093
  • 13
  • 31
  • 39
scowles4
  • 1
  • 1

1 Answers1

1

There are a variety of ways to identify the availability of Flash. You need to add such a test to your $(document).ready() function, and tweak the invocation of DataTables accordingly:

$(document).ready(function(){
   var hasFlash = <<preferred method of testing>>
   var sDom = hasFlash ? "<sdomstring with 'T' option>" : "<sdomstring without 'T'>" ;
   $('#example').dataTable({
        "sDom": sDom,
        "oTableTools": {
            "sSwfPath": "/swf/copy_cvs_xls_pdf.swf"
        } // this should be inert without T in sDom
    });
});

Hopefully that will get you on your way.

Community
  • 1
  • 1
RET
  • 9,100
  • 1
  • 28
  • 33