Csv Button not showing Removed table tool references

Csv Button not showing Removed table tool references

novatroop77novatroop77 Posts: 14Questions: 4Answers: 0
edited August 2021 in DataTables 1.10

Hi I have loaded my files in accordance to the layout here https://datatables.net/download/
I removed old references to table tools and obuttons and as you see I have the new buttons tag their ideally am wanting the html csv button but its not showing for me.

I cannot provide a link to a full example sorry.

AS per

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/base/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.0.0/css/buttons.jqueryui.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.jqueryui.css"/>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.0.0/js/dataTables.buttons.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.0.0/js/buttons.jqueryui.js"></script>
 <script type="text/javascript" src="https://cdn.datatables.net/buttons/2.0.0/js/buttons.html5.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/2.0.0/js/buttons.print.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/responsive/2.2.9/js/responsive.jqueryui.js"></script>

But for Some reason am still not getting my buttons to appear I only want the csv button to appear we are using ie 11 but still the buttons are not showing we need the sDom as well as we are placing a custom span there I removed info that could like it back to the code base below

var oTable = $('#tst').dataTable({  
    "dom": 'Bfrtip',
    "sDom": " custom span goes here",
    "bServerSide": false,
    "sAjaxSource": "Controler/Action/Method",
    "bProcessing": true,
    "bDeferRender": true,
    "iDisplayLength": 10,
    "bAutoWidth": false,
    "buttons": [ 'csv'],
    "oLanguage": {
        "sSearch": "Search:"
    }

});

Please I no above is not the normal way to initialize data tables its in the code base and cannot change it.

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Nothing looks wrong there, so we're going to need to see it. 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

  • kthorngrenkthorngren Posts: 20,301Questions: 26Answers: 4,769

    Are you loading jquery.js and jquery.dataTables.js? I copied your above code into a test case and found I needed to add those includes and it displays the CSV button:
    http://live.datatables.net/xaheweju/1/edit

    Kevin

  • novatroop77novatroop77 Posts: 14Questions: 4Answers: 0

    Hi @kthorngren I am but the jquery is version 1.9.1a and I am loading jquery.datatables.min.js , is it requirment that Jquery be on newer version for html5 button?

  • novatroop77novatroop77 Posts: 14Questions: 4Answers: 0

    I Should note this is asp.net mvc solution

  • novatroop77novatroop77 Posts: 14Questions: 4Answers: 0

    @kthorngren It was the jquery version it neeeds to be more recent that what we had its now displaying this thread can be removed thanks @colin

  • novatroop77novatroop77 Posts: 14Questions: 4Answers: 0

    Question is their a way to give the filename a unique file name via parameter?

  • kthorngrenkthorngren Posts: 20,301Questions: 26Answers: 4,769
    edited September 2021

    See the filename example of how to set the filename. Use the buttons.exportInfo() docs to see all the options for setting the title. You can use a function to dynamically define the filename or a string to statically define the name.

    Kevin

Sign In or Register to comment.