src/js/db/table.js
/**
* write table data to csv encoded string
* @param {Table} Tbl table to be text/csv encoded
* @param {String} FS field seperator
* @return {String} text/csv encoded string
*/
write table data to csv encoded string
write table data to csv encoded string
function write_csv(Tbl, FS) {
    var Text = "", Row;
    if (Tbl.header) {
        for (var i = 0; i < Tbl.header.length; i++) {
            if (i > 0)
                Text += FS;
            Text += escape_csv(Tbl.header[i], FS);
        }
        Text += "\r\n";
    }
    for (var i = 0; i < Tbl.data.length; i++) {
        Row = Tbl.data[i];
        for (var j = 0; j < Row.length; j++) {
            if (j > 0)
                Text += FS;
            Text += escape_csv(Row[j], FS);
        }
        Text += "\r\n";
    }
    return Text;
}
function write_csv ( Tbl , FS ) { var Text = "" , Row ; if ( Tbl . header ) { for ( var i = 0 ; i < Tbl . header . length ; i ++ ) { if ( i > 0 ) Text += FS ; Text += escape_csv ( Tbl . header [ i ] , FS ) ; } Text += "\r\n" ; } for ( var i = 0 ; i < Tbl . data . length ; i ++ ) { Row = Tbl . data [ i ] ; for ( var j = 0 ; j < Row . length ; j ++ ) { if ( j > 0 ) Text += FS ; Text += escape_csv ( Row [ j ] , FS ) ; } Text += "\r\n" ; } return Text ; }
write table data to csv encoded string
write table data to csv encoded string