table tools button click invocation on custom link click

table tools button click invocation on custom link click

sreenu539sreenu539 Posts: 10Questions: 2Answers: 0
edited November 2013 in TableTools
Hello everyone,

I have a menu which shows menu items to be selected, one of the menu item is to download data of table as excel.

The following is the excerpt of code to have excel table tool button as hidden and appended to "hiddenTool" div.
(I could see the excel button and embed swf inside the hidden div).
[code]
"sDom": '<"#table_header"<"#inner_table_header"<"filtertx">fCT<"filterbtn">>>tipl',

"oTableTools": {
"aButtons": [{"sExtends": "xls", "sButtonText":"xls","mColumns": "visible",
"fnInit":function(nButton,oConfig)
{
//console.log($('embed'));
}
}],


"sSwfPath": "<%=request.getContextPath()%>/merlin/js/swf/copy_cvs_xls_pdf.swf"

},
"fnInitComplete":function() {
$('.ColVis').appendTo("#toolButton");
$("#more_action").css("margin","0");
$('.DTTT_container').appendTo("#hiddenTool");
$('button.DTTT_button').css("border","1px solid #7EA69E!important");
$(".ColVis_Button").attr("id","addRemoveBtn");
$('.DTTT_container').css('left',0);
$('.DTTT_container').css('position','absolute');
$('.DTTT_container').css('top',0);
$('.ColVis').css('display','none');
$('#selectAll').css('margin-right','-8px');

eTime=new Date().getTime();
loadTime=(eTime-sTime);
}


[/code]

Question: Now, I have a simple link and on click of the link I am triggering the following code.
[code]
function rollover() {

$( "#ToolTables_example_0" ).trigger( "fnClick"); // tried but not working
$( "#ToolTables_example_0" ).trigger( "click"); // tried but not working
$( ".DTTT_button_xls" ).trigger( "click"); // tried but not working
$( ".DTTT_button_xls" ).trigger( "fnClick"); // tried but not working
}
[/code]
The above function is getting called BUT not triggering the excel button click so that it would open file system window to save the file.

[quote]In simple words, how to invoke fnClick of a table tool button on a custom link.[/quote]

I really appreciate any ideas or inputs on this.

Thank you,
Sri

Replies

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Hi,

    Its not possible I'm afraid. Its a security feature of Flash, so it can't trigger a file save or copy to clipboard without the user knowing it. It would be a huge problem if you could copy to clipboard on just a hover event!

    Allan
  • sreenu539sreenu539 Posts: 10Questions: 2Answers: 0
    edited November 2013
    Allan,

    Thank you for your kind reply.

    Just for completeness, here is the code that I tried to simulate click of excel button when I click a link. (DID NOT WORK THOUGH)

    [code]
    "oTableTools": {
    "aButtons": [ {
    "sExtends": "xls",
    "sButtonText": "excel",
    "sDiv": "xls",
    }],
    "sSwfPath": "/js/swf/copy_cvs_xls_pdf.swf"
    }

    [/code]

    [code]
    $( "#custom" ).on( "click", function(e) {
    alert( $( this ).text() );
    $( ".DTTT_button" ).click();
    })
    [/code]

    I tried various options in the above on click of link. [quote] Logically speaking click on the excel button should happen, Do you still say it is due to flash buttons ? [/quote]

    [code]

    $( ".DTTT_button" ).click();
    $( ".DTTT_button_xls" ).click();
    $( ".DTTT_button_xls_hover" ).click();
    $( "#ToolTables_example_0" ).click();
    [/code]

    Thanks again,
    Sri
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    edited November 2013
    I'm not sure which part I wasn't clear about. This isn't possible. It is an intentional limitation Adobe put into Flash. It would be a massive security whole otherwise.

    Allan
This discussion has been closed.