Buttons PlugIn - Require replacement for bBomInc
Buttons PlugIn - Require replacement for bBomInc
Hi,
I am using DataTables 1.10.8 and Buttons1.0.0
I was using Tabletools 2.2.1 and upgrading to Buttons1.0.0 when I encountered the following requirement.
I use translations on my page and with TableTools i was able to download translated data using the code snippet below:
$('#table-name').dataTable( {
"sDom": "T<'clear'>lfrtip",
"oTableTools": {
"sSwfPath": "/common/scripts/dt/1100/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "csv",
"sFileName": "Qualifications_Passed.csv",
"bBomInc": true,
"sButtonText": "Save As CSV"
}],
"aaSorting": [],
"sPaginationType": "full_numbers",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"iDisplayLength": 10,
"bAutoWidth": false,
"bProcessing": true,
"oLanguage": {"sSearch": "Search"}
} );
And now on upgrade to Buttons 1.0.0 , I could replace all the above as follows but could not find a replacement for "bBomInc": true
$('#table-name').dataTable( {
"dom": "TBlfrtip",
"buttons": [
{
"extend": "csvHtml5",
"title": "Qualifications_Passed",
"bBomInc": true,
"text": "Save As CSV",
"fieldBoundary":'"'
}],
"order": [],
"pagingType": "simple_numbers",
"LengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"pageLength": 10,
"autoWidth": false,
"processing": true,
"language": {"search": "Search"}
});
What would be the replacement for bBomInc ?? This needs to be there for downloading the translated stuff correctly otherwise it does not work.
Also, can how do I place the Buttons on the left beside the Search box instead of right, tried to fiddle with the dom attribute but with no luck.
Any help is greatly appreciated !
Thanks in Advance.
Replies
Hi,
There is no BOM option for Buttons at the moment. I found that it caused more hassle than it was worth in TableTools and so wanted to remove it in Buttons.
Can you link to the page showing the issue so I can debug it please. I've use Button's export options successfully with UTF8 characters without the BOM myself, so I would be interested to see if I can reproduce the issue on your page.
Allan
Hi Allan,
Thank you for your prompt response.
I am sorry that I cannot link you to my page due to security reasons.
I observed that the CSV file generated opens fine when I try to open with Notepad but if I open the same file in Microsoft Excel it shows the content as special characters instead of the actual content.
This was not the case with TableTools generated CSV file when I used bBomInc attribute.
Is there any way I can make it happen on Buttons too ?
Also, how do I place the Buttons on the left beside the Search box instead of right, tried to fiddle with the dom attribute but with no luck.
Could you help with this too !
No sorry. As I stated above there is no option to include a BOM in Buttons. To understand why Excel is not working I would need to be able to recreate the issue myself.
Use CSS -
div.dt-buttons { float: right }
.Allan
I can share with you a sample of the CSV file data I have if that can be useful to check this. You could use the file to open in Notepad and Excel to check the difference.
Any help is greatly appreciated.
Thank you for the help regarding the CSS of the Buttons.
Sample CSV file data :
"计划","颜色"
"1118","绿色"
"1119","绿色"
"1120","绿色"
Thanks for the test data - yes that appears to cause Excel issues. Its unbelievable that it won't read a UTF8 CSV file without a BOM...
I guess I'll need to look at adding that option back in. I can't say exactly when at the moment as things are a bit busy at the moment, but I will get to it.
Thanks for posting this.
Allan
It would be great if that feature can be added !
Still trying figure out a workaround though, Thanks for your great work Allan !
Would love to provide feedback if I find any other issues.