Rename export excel file using value from ColdFusion
Rename export excel file using value from ColdFusion
Hi,
I want to share this codes since I manage to get it worked and hope it will help others too.
First we must convert the cf value into something that datatables can understand, so you can refer toScript for converting value from ColdFusion to JavaScript. Then call the value inside the buttons init().
Below example of my cf value:
'''<cfoutput>
<cfset thisString = "#OrgName# (#id#)">
<script type="text/javascript">
function getThis() {
var #toScript(thisString, "jsVar")#;
return jsVar;
}
</script>
</cfoutput>'''
and in my datatables buttons:
'''buttons: [
{
extend: 'excel',
title: '',
init: function(dt, node, config) {
var strVar = getThis();
config.title = 'some text ' + strVar;
},
}
]'''