table tools custom link

table tools custom link

sreenu539sreenu539 Posts: 10Questions: 2Answers: 0
edited November 2013 in General
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).

"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);
}




Question: Now, I have a simple link and on click of the link I am triggering the following 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
}

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.

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

I really appreciate any ideas or inputs on this.

Thank you,
Sri

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    This sounds more or less identical to: http://datatables.net/forums/discussion/18417/table-tools-button-click-invocation-on-custom-link-click#Item_2 .

    Allan
This discussion has been closed.