Lamloumi Afif
Lamloumi Afif

Reputation: 9081

Delete button without editing flash file

I have used the DataTable javascript tool to export a grid, So I get this html generated-code :

     <div class="DTTT_container">
        <a class="DTTT_button DTTT_button_copy" id="ToolTables_example_0" tabindex="0" aria-controls="example"><span>Copy</span><div style="position: absolute; left: 0px; top: 0px; width: 44px; height: 29px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_5" src="../Content/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="44" height="29" name="ZeroClipboard_TableToolsMovie_5" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&amp;width=44&amp;height=29" wmode="transparent"></div></a>
        <a class="DTTT_button DTTT_button_csv" id="ToolTables_example_1" tabindex="0" aria-controls="example"><span>CSV</span><div style="position: absolute; left: 0px; top: 0px; width: 38px; height: 29px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_2" src="../Content/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="38" height="29" name="ZeroClipboard_TableToolsMovie_2" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&amp;width=38&amp;height=29" wmode="transparent"></div></a>
        <a class="DTTT_button DTTT_button_xls" id="ToolTables_example_2" tabindex="0" aria-controls="example"><span>Excel</span><div style="position: absolute; left: 0px; top: 0px; width: 45px; height: 29px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_3" src="../Content/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="45" height="29" name="ZeroClipboard_TableToolsMovie_3" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=3&amp;width=45&amp;height=29" wmode="transparent"></div></a>
        <a class="DTTT_button DTTT_button_pdf" id="ToolTables_example_3" tabindex="0" aria-controls="example"><span>PDF</span><div style="position: absolute; left: 0px; top: 0px; width: 39px; height: 29px; z-index: 99;"><embed id="ZeroClipboard_TableToolsMovie_4" src="../Content/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="39" height="29" name="ZeroClipboard_TableToolsMovie_4" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=4&amp;width=39&amp;height=29" wmode="transparent"></div></a>
        <a class="DTTT_button DTTT_button_print" id="ToolTables_example_4" title="View print view" tabindex="0" aria-controls="example"><span>Print</span></a>
    </div>

the flash image :

enter image description here

I'd like to remove the first button so I added this script

$(".DTTT_button DTTT_button_copy").remove();

I get the same image as result!!!! So:

  1. What is the reason of this ?
  2. How can I remove buttons without editing swf file?

Upvotes: 0

Views: 147

Answers (2)

akmozo
akmozo

Reputation: 9839

You can also use CSS to just hide the desired element :

.DTTT_button_copy, #ToolTables_example_0 
{
    display: none;
}

Hope that can help.

Upvotes: 2

Meenesh Jain
Meenesh Jain

Reputation: 2528

the content of datatable are added in the page after the page has been loaded

so your code is not able to find datatable button

$(document).ready(function(){
    setTimeout(function(){
      $(".DTTT_button DTTT_button_copy").remove();
    },100);
});

try putting your code in a timeout which will work after all the content are loaded

Upvotes: 1

Related Questions