locked
Exporting Lightswitch HTML table to CSV RRS feed

  • Question

  • Hello,

    I am trying to integrate this Javascript example  into a Lightswitch HTML project.

    So far I have added a button and pasted the Javascript from that fiddle into its _execute code.

    I am then using Chrome's dev tools to find the name of the table on my screen, but what I see so fat is 'ID=""'.

    Am I correct in thinking that I need to div id and table id in the args of this Javascript? It is at the bottom...

            // This must be a hyperlink
            $(".export").on('click', function (event) {
                // CSV
                var args = [$('#dvData>table'), 'export.csv'];
    
                exportTableToCSV.apply(this, args);
    
                // If CSV, don't do event.preventDefault() or return false
                // We actually need this to be a typical hyperlink
            });
        });
    };
    Any advice on integrating this example in Lightswith HTML is much appreciated. Thank you


    Monday, April 17, 2017 12:59 PM

All replies

  • Hi CreedCor,

    Here is the sample to export data to CSV with lightswitch:

    https://hgminerva.wordpress.com/2012/05/28/how-to-export-data-to-csv-using-microsoft-lightswitch-web-application/

    Best Regards,

    Yuk Ding

    Wednesday, April 26, 2017 8:08 AM