Anonymous
22 Apr, 2018

Is There An Easy Way To Export Database Resultset To Excelsheet?

1 Answer         5598 Views

Webtrickshome
22 Apr, 2018

Download the js files listed below that has got all the necesarry blocks of codes you need to be able to export an HTML table to excelsheet and add links to those js files in your page.

Create a button for download and give it an id button and give the id myTable to your table. You can replace those ids with the ones you prefer.

Once you have done that, add this script in your view file and declare the class or id names you defined for the button and the table and you are done.

 
<script type="text/javascript"> 
    $("#button").click(function() { 
        $('#myTable').tableExport({ 
            type : 'excel', 
            escape : 'false', 
            ignoreColumn: [] // add column names as array here if you need to exclude any of them 
        }); 
    }); 
</script>   

Download js files from here.

export.js

base.js


227 Likes         0 Dislike         0 Comment        


Leave a comment