I know about that option but i have stored the date in a variable and then i want to put it into the filename...so when ever the user exports thje pdf he would get current date into the filename.
for date : var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
The above thing sFileName=d; is not working,please help me on this...I have got the date into a variable:
for date : var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
var d = day + "/" + month + "/" + year;
Now i want to put it into my export filename along with the table name
I had put the sFileName:d; but it doesnt even open the pdf saving box now..nothing happens when the pdf button is clicked...please suggest me on this or if you may have some other option which can help...
I cant its for an client application :( ...if you could try it out on a datatable to use sFileName="somename"+d; and see if that works cause for me I was using it for the pdf option but now the pdf option itself is not working(nothing happens if clicked on pdf).
It's the `/` in the file name. That's invalid on most operating systems. Apparently Flash doesn't give a working about it.
Use `-` instead. This works for me:
[code]
$(document).ready( function () {
var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
Replies
Allan
I know about that option but i have stored the date in a variable and then i want to put it into the filename...so when ever the user exports thje pdf he would get current date into the filename.
for date : var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
var d = day + "/" + month + "/" + year;
then what shall i put into sFilename : ""
Allan
The above thing sFileName=d; is not working,please help me on this...I have got the date into a variable:
for date : var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
var d = day + "/" + month + "/" + year;
Now i want to put it into my export filename along with the table name
"sDom": 'T<"H"lfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy",
"print",
{
"sExtends": "collection",
"sButtonText": "Export",
//"mColumns": "visible",
"aButtons": [
{
"sExtends": "csv",
"sButtonText": "CSV",
"mColumns": "visible"
},
{
"sExtends": "xls",
"sButtonText": "Excel",
"mColumns": "visible"
},
{
"sExtends": "pdf",
"sButtonText": "PDF",
"sPdfOrientation": "landscape",
"sFileName": d,
"mColumns": "visible"
}]
}
]
}
I had put the sFileName:d; but it doesnt even open the pdf saving box now..nothing happens when the pdf button is clicked...please suggest me on this or if you may have some other option which can help...
Allan
Use `-` instead. This works for me:
[code]
$(document).ready( function () {
var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
var d = day + "-" + month + "-" + year;
$('#example').dataTable( {
"sDom": 'T<"clear">lfrtip',
oTableTools: {
aButtons: [ {
sExtends: 'csv',
sFileName: d+'.csv'
} ]
}
} );
} );
[/code]
Allan
It worked...