change CSV delimiter
change CSV delimiter
boudga
Posts: 19Questions: 4Answers: 0
When using TableTools.js it automatically delimits generated CSVs with a comma as usual but I want to use a pipe. how can I change this in your JavaScript?
This discussion has been closed.
Replies
[code]
function fnFeatureSaveCSV ()
{
var sBaseClass = "TableTools_button TableTools_csv";
var nButton = document.createElement( 'div' );
nButton.id = "ToolTables_CSV_"+_iId;
nButton.style.height = _oSettings.iButtonHeight+'px';
nButton.style.width = _oSettings.iButtonWidth+'px';
nButton.className = sBaseClass;
_nTools.appendChild( nButton );
var clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
clip.setAction( 'save' );
clip.setFileName( fnGetTitle()+'.csv' );
clip.addEventListener('mouseOver', function(client) {
nButton.className = sBaseClass+'_hover';
} );
clip.addEventListener('mouseOut', function(client) {
nButton.className = sBaseClass;
} );
clip.addEventListener('mouseDown', function(client) {
clip.setText( fnGetDataTablesData("|") );
} );
fnGlue( clip, nButton, "ToolTables_CSV_"+_iId, "Save as CSV" );
}
[/code]
[code]
fnFlashSetText( clip, fnGetDataTablesData(",", TableToolsInit.sCsvBoundary) );
[/code]
It would probably be worth upgrading.
I didn't provide an option to change the separator, given the expansion of the CSV acronym :-). But changing that line should do the trick!
Regards,
Allan