Datatables Plugin excel button only exporting hardcoded row data

Datatables Plugin excel button only exporting hardcoded row data

ValenkValenk Posts: 1Questions: 1Answers: 0
edited January 9 in Free community support

I am creating a table in a view for a asp.net MVC project. The table template itself is already set up in the view (hardcoded) and i populate the table via javascript using json data from ajax. The table is populating the way I want it too though when I use the Datatable excel button it creates the table in excel but there is no data just the column names.

For reference I am using the example at https://datatables.net/extensions/buttons/examples/html5/simple.html

I have all the dependencies listed in the above link. I harcoded one row into the table and that works when I export the table to excel but not my dynamic data from my script.

I have tried putting the jquery excel button creation code in different parts of my script and that has not work (as you will see in my code) It is only working when i hardcoded a row in the table, not with dynamic data being created and put in the table

I have attached a txt file with my code (sorry I couldnt format it correctly in this box)

Answers

  • colincolin Posts: 4,305Questions: 0Answers: 766

    Hi @Valenk ,

    It shouldn't really matter where it's placed. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

Sign In or Register to comment.