how to extend a button click event and call it base click event
how to extend a button click event and call it base click event
Hi all, I saw on the documentation how to extend a button:
my problem is that I want to do something before the click event and than call the original click event that will generate my pdf file.
var tableTools = new $.fn.dataTable.TableTools( oTableDayTrading, {
"aButtons": [
{ "sExtends":"pdf", "fnClick":
function ( nButton, oConfig, oFlash ) {
doSomething();
//call the original function that generates the pdf file
)...
Answers
OK, I was able to overcome this by adding the following:
{"sExtends":"pdf","fnClick":function (nButton, oConfig, flash ) {/*-----------------works-----------------------------* this.fnSetText( flash,"title:"+ this.fnGetTitle(oConfig) +"\n"+ "message:"+ oConfig.sPdfMessage +"\n"+"colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+ "orientation:"+ oConfig.sPdfOrientation +"\n"+"size:"+ oConfig.sPdfSize +"\n"+ "--/TableToolsOpts--\n" +this.fnGetTableData(oConfig));------------------doesn't works------------------------------*/var that = this;getReportData(productTypes.dayTrading,function(response) {renderDayTrading(extendItems(response.dayTrading));that.fnSetText( flash,"title:"+ that.fnGetTitle(oConfig) +"\n"+ "message:"+ oConfig.sPdfMessage +"\n"+"colWidth:"+ that.fnCalcColRatios(oConfig) +"\n"+ "orientation:"+ oConfig.sPdfOrientation +"\n"+"size:"+ oConfig.sPdfSize +"\n"+ "--/TableToolsOpts--\n" +that.fnGetTableData(oConfig));});/*------------------doesn't works------------------------------*/}},but now I'm getting:
"this.movie.clearText is not a function" on tableTools.js.
if I'm removing the fnClick extension the this.movie.clearText is defined and working. any idea on how to work it out?