Template:Table2CSV

    Table of contents
    No headers
    var classorid = ($id ?? $0 ?? '#exportthis');
    var text = ($text ?? $1 ?? 'Export Table');
    var separator = ($separator ?? $2 ?? ',');
    var header = ($header ?? $3 ?? []);
    var button = ($button ?? $4 ?? false);
    var tofile = ($tofile ?? $5 ?? true);
    
    var options = {separator: (separator)};
    
    if(#header != 0) {
        let options ..= {header: (header)};
    }
    
    if(tofile) {
        let options ..= {delivery:'value'};
    }
    
    
    
    // var ctortext = 'when($this.click) $('..json.emit(options)..').table2CSV('..json.emit(options)..');';
    
    if(button) {
        <input value=(text) type="button" ctor="when($this.click) GetTable()" />
    } else {
        <a href="#" ctor="when($this.click) GetTable(); return false;">;text;</a>
    }
    
    <html><head>
    <script type="text/javascript" src="http://developer.mindtouch.com/@api/deki/files/4807/=table2CSV.js" ></script>
    <script type="text/javascript">"
    var GetTable = function() {
                        var myOpts = "..json.emit(options)..";
                        var tbl = "..json.emit(classorid)..";
                        var siteURI = "..json.emit(site.uri).."
                        var fulluri = siteURI + 'deki/dl/dlstring.php?csv_output=';
    
                        if(myOpts.delivery == 'value') {
                            var csv = $(tbl).table2CSV(myOpts);
                            location.href = fulluri + encodeURIComponent(csv);
                        } else {
                            $(tbl).table2CSV(myOpts);
                        }
                    }
    "</script>
    </head></html>
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by